react-native: Animated: `useNativeDriver` was not specified. This is a required 'option and must be explicitly set to `true` or `false`
warn: Animated: useNativeDriver
was not specified. This is a required 'option and must be explicitly set to true
or false
Is the default value of useNativeDriver
invalid?
Description
Animated.timing(this.spinValue, { toValue: 1, duration: 500, easing: Easing.linear }).start();
React Native version:0.62.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17
Commits related to this issue
- perf: set `useNativeDriver` to true on animations This serves master a performance improvement as well as a fix for the numerous warnings that come up when using Animations without passing the `useNa... — committed to mernxl/react-native-skeleton-content-nonexpo by mernxl 4 years ago
- Explicitly set useNativeDriver Get rid of warnings - https://github.com/facebook/react-native/issues/28558 — committed to dvorjackz/react-native-circular-action-menu by dvorjackz 4 years ago
Animated:
useNativeDriver
was not specified. This is a required option and must be explicitly set totrue
orfalse
react native 0.62 Animated.timing(this.state.animatedValue, { toValue: 1, duration: 500, useNativeDriver: true, // <-- Add this }).start();
Is there some way to track which of the million components and dependencies in my project is causing this error? It’s so spammy logging is basically unusable, but I’m given no information about which function/component/package contains the issue.
Yet no one mentions what is useNativeDriver and whether changing it to
true
orfalse
is preferred.I’m surprised that the documentation for Animated in all cases states
useNativeDriver
defaults to some value, but in actuality you’re required to set it.Explicitly setting the option will make the warning disappear. https://reactnative.dev/blog/2017/02/14/using-native-driver-for-animated#how-do-i-use-this-in-my-app
Facing the same issue for a long time and still no update from native-based developers yet in 2020.
Meanwhile use a workaround to avoid irritating yellow warnings of useNativeDriver.
UPDATE RN V0.63 ABOVE
YellowBox
is now changed and replace withLogBox
.FUNCTIONAL
CLASS BASED
UPDATE RN V0.63 BELOW FUNCTIONAL
CLASS BASED
I which file we can find Animated.timing ?
@zhanfashion note that this is an intentional change in 0.62 (changelog#deprecated) – see a bit of an explanation in the description of the commit here. You can silence this specific warning using YellowBox, but bear in mind that at some point in the future the default value for
useNativeDriver
will change, possibly causing your current code to error.https://reactnative.dev/blog/2017/02/14/using-native-driver-for-animated#how-do-i-use-this-in-my-app ref this url
@safaiyeh
There are too many Animated in the old project, it is too difficult to fix the warning. If you do n’t specify
useNativeDriver: true or false
, it will cause a warningdemo
https://github.com/zhanfashion/animatedDemo
info