Animated.event() with useNativeDriver returns an object, not a function
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 7.8.0 Yarn: 1.0.1 npm: 4.2.0 Watchman: 4.7.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: Not Found
Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.1 => 0.49.1
Target Platform: iOS (11)
Steps to Reproduce
I just hit https://github.com/facebook/react-native/issues/13377 but with onScroll
on a ScrollView
. This line checks if I have used useNativeDriver
, and if so, returns the AnimatedEvent
object, not a function. Therefore, any prop expecting a function – onScroll
, onPanResponderMove
or any other – will throw an error.
Is this a bug or expected behaviour? If useNativeDriver
cannot be used with any prop expecting a function, this should be documented.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
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
You can use the useRef Hook to return a mutable ref object. ... other events can map directly to animated values using Animated.event()...
Read more >Animated and React Native ScrollViews | by evening kid
In today's chapter, let's learn about animated events with scroll views. This was first published as a video for the How To Animated...
Read more >TypeError: Object(...) is not a function (React) - appsloveworld
Coding example for the question TypeError: Object(...) is not a function (React)-React Native.
Read more >All you Need to Know to Become a Top React Native ...
Still, it is not unusual for developers to encounter performance ... In the above example, Animated.event returns a function that sets the ...
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 FreeTop 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
Top GitHub Comments
Hi, are you using an
Animated.ScrollView
?You’re welcome 👍 it already says so in the docs, look closer at the given example - but you’re right, it’s a tiny detail easy to overlook. Highlighting might help there. Happy to have helped 😃