Support for Animated.event
See original GitHub issueHey!
Thanks for a great lib.
Any way to add an onScroll Animated.event to the component for some cool animation shenanigans? 😃
Would be awesome if one could do something along the lines of
<KeyboardAwareScrollView
style={styles.container}
onScroll={Animated.event(
[{ nativeEvent: { contentOffset: { y: this.state.scrollY } } }],
{ useNativeDriver: true }
)}
>
<View />
</KeyboardAwareScrollView>
Issue Analytics
- State:
- Created 6 years ago
- Comments:15
Top Results From Across the Web
React Native Animated with useNativeDriver - Stack Overflow
Short answer: it isn't possible. You can use native driver only by passing Animated.event into onScroll handler.
Read more >Animated - React Native
The Animated library is designed to make animations fluid, powerful, ... events can map directly to animated values using Animated.event() .
Read more >Animated.event - React Native Animated for Beginners
Animated.event. This is just a helper function to map arbitrary data to Animated values. Check out the docs for their explanation ...
Read more >Animated.event() with useNativeDriver returns an object, not a ...
event () with useNativeDriver returns an object, not a function #16250. Resolution: Locked.
Read more >Non-Native and Native Animated Values in React Native
Some may be supported by the native driver (such as transform, or opacity), ... Calling Animated.event can actually return two things, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cool, thanks! It works! 😃
For anyone coming across this issue, remember to make the component animated using
Animated.createAnimatedComponent
, otherwise it will not work. Something like:In my case if I use this { useNativeDriver: true }, it stops working