I am building a project with React Native (version 0.59.10). Whenever I run my tests (using Jest) I get this warning:
console.warn node_modules/react-native/Libraries/Animated/src/NativeAnimatedHelper.js:248
Animated: `useNativeDriver` is not supported because the native animated module is missing. Falling back to JS-based animation. To resolve this, add `RCTAnimation` module to this app, or remove `useNativeDriver`. More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420
This seems to be due to the use of Animated
in TouchableOpacity
which is in turn used by Button
from 'react-native-elements'.
Looking into my project with Xcode I can see that the RCNativeAnimation
project is there:
I checked the referenced link: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420 but that is ages old and refers to very old versions of both React Native and Xcode.
I am guessing this warning is just related to the native RCNativeAnimation
module not being accessible from the tests but I am at a loss as to how to 'remove useNativeDriver
' within the test context. Obviously in the real app I want to ensure I am using the native animation libraries, but in the unit tests I don't care.
What is the recommended way to eliminate this warning?
change the jest.mock to:
jest.mock('react-native/Libraries/Animated/src/NativeAnimatedHelper');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With