Open
Conversation
1. React.forwardRef – the HOC returns a forward-ref component.
2. captureScrollerRef – the inner list’s ref callback sets this.scroller.current and forwards the outer ref (Animated’s merged ref + your listRef) to that same FlatList instance.
3. forwardedRef is stripped from props before {...restProps} so it is not passed down to FlatList.
4. Wrapper View keeps collapsable={false} so the IO root view is not flattened away on Android.
Intersection logic still uses nativeRef on the wrapper View for root.node; scroll + Animated use the list instance.
Update withIO.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: Native scroll mapping does not work on IOFlatList when using Animated.event with useNativeDriver: true
Animated.event( [{ nativeEvent: { contentOffset: { y: scrollY } } }], { useNativeDriver: true }, );the mapped Animated.Value (e.g. scrollY) often does not update on the native animated path, so anything that depends on it—interpolate, translateY, opacity, etc.—does not follow the scroll.
Expected Behavior: Same as Animated.FlatList: with useNativeDriver: true, scroll contentOffset should drive the linked Animated nodes on the UI thread so header parallax, sticky UI, and other scroll-linked animations stay smooth and in sync.
Fix: Animated.event / useNativeDriver: true with IOFlatList (and other IO scrollables) by forwarding refs to the inner list
Animated.createAnimatedComponent(IOFlatList) could not reliably drive contentOffset → Animated.Value on the native thread (useNativeDriver: true). This change forwards the merged ref from Animated (and any consumer ref) to the underlying FlatList / ScrollView, so native animated scroll listeners attach to the real scroll view instead of the intersection-observer wrapper.