question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animated.event() with useNativeDriver returns an object, not a function

See original GitHub issue

Is 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
marcesengelcommented, Oct 10, 2017

Hi, are you using an Animated.ScrollView?

2reactions
marcesengelcommented, Oct 10, 2017

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found