How to Fix Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`?
2 min readNov 5, 2020
You can fix this warning in a lot of ways and I will explain all ways I tried to fix the warning
1- First solution for Animation and Animatable As the warning says, we need to specify the useNativeDriver
option explicitly and set it to true
or false
.
1- Animation methods
Refer to Animated doc , with animation types or composition functions, for example, Animated.decay()
, Animated.timing()
, Animated.spring()
, Animated.parallel()
, Animated.sequence()
, specify useNativeDriver
.
Animated.timing(this.state.animatedValue, {
toValue: 1,
duration: 500,
useNativeDriver: true, // Add this line
}).start();
2- Animatable components
Animated
exports the following animatable components using the above wrapper:
Animated.Image
Animated.ScrollView
Animated.Text
Animated.View
Animated.FlatList