You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to implement a stickyHeader component that relies on the scroll event of the scrollView to get the latest contentOffset.y. Then, by listening to the changes in y, I can set the translateY property of the stickyHeader.
However, when the content height of the scrollView changes dynamically, especially when it decreases, using addListener to track the animation value changes, we find that when useNativeDriver is set to true, Animated.event sometimes fails to update the latest contentOffset.y value. The listener callback of Animated.event prints e.nativeEvent.contentOffset.y as the latest value, but printing animatedValue.__getValue still shows the previous value.
Unfortunately, we cannot trigger the animation value change in the listener callback of Animated.event, as that would cause the sticky animation to flicker.
Steps to reproduce
Install the app.
Click on tab1 and scroll the scroll-view content to the bottom.
Click on tab2.
Repeat steps 2 and 3 to reproduce the issue.
I cannot reproduce the issue in the emulator; it only occurs sporadically on a real device.
Description
I want to implement a stickyHeader component that relies on the scroll event of the scrollView to get the latest contentOffset.y. Then, by listening to the changes in y, I can set the translateY property of the stickyHeader.
However, when the content height of the scrollView changes dynamically, especially when it decreases, using addListener to track the animation value changes, we find that when useNativeDriver is set to true, Animated.event sometimes fails to update the latest contentOffset.y value. The listener callback of Animated.event prints e.nativeEvent.contentOffset.y as the latest value, but printing animatedValue.__getValue still shows the previous value.
Unfortunately, we cannot trigger the animation value change in the listener callback of Animated.event, as that would cause the sticky animation to flicker.
Steps to reproduce
I cannot reproduce the issue in the emulator; it only occurs sporadically on a real device.
React Native Version
0.80.1
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
https://github.com/yandadaFreedom/reproducer-react-native-0.80.1/tree/bug-animated-event
Screenshots and Videos
The issue is reproduced at the 35-second mark in the video.
249_1752737057.mp4