react-native-reanimated: Importing createDrawerNavigator throws 'NativeReanimated' error.
Description
After following the installation instructions for React Navigation and then Drawer Navigation, I am getting a NativeReanimated error.
I have reanimated in both my package-lock.json:
"react-native-reanimated": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.0.0.tgz",
"integrity": "sha512-kIrdBoXSky7DQ62SOgosgimKM+Lt+SzAaM+ovVpCLBcwUK2aYRfLxa9ffgvKjeH9/n7dONlwEMjbKssGkuyq2Q==",
"requires": {
"@babel/plugin-transform-object-assign": "^7.10.4",
"fbjs": "^3.0.0",
"mockdate": "^3.0.2",
"string-hash-64": "^1.0.3"
}
and in my package.json:
"dependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/drawer": "^5.12.4",
"@react-navigation/native": "^5.9.3",
"@react-navigation/stack": "^5.14.3",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.18.1"
}
It was installed vis the React Navigation instructions as follows:
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
This is the error I’m receiving in Metro and node after running npx react-native run-android: [Sat Mar 06 2021 10:25:12.380] BUNDLE ./index.js
[Sat Mar 06 2021 10:25:15.192] ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(…): ‘NativeReanimated’ could not be found. Verify that a module by this name is registered in the native binary. [Sat Mar 06 2021 10:25:15.196] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) [Sat Mar 06 2021 10:25:15.196] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
In the emulator I’m just receiving a blank white screen.
Screenshots
Steps To Reproduce
- Try to run the app via: npx react-native run-android
Expected behavior
The app should run.
Actual behavior
I get a blank white screen.
Snack or minimal code example
Commenting out this line: import { createDrawerNavigator } from ‘@react-navigation/drawer’; fixes the error.
Package versions
Windows 10 Visual Studio Code
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/drawer": "^5.12.4",
"@react-navigation/native": "^5.9.3",
"@react-navigation/stack": "^5.14.3",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.18.1"
- NodeJS: v10.19.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 22
run
npx react-native start --reset-cache
after thatnpx react-native run-android
ornpx react-native run-ios
thank yo bro… I almost went crazy.
Yay - it finally works. I’ve tried a couple of things before it has actually worked. I had to reinstall / downgrade the react-navigation libs AND downgrade to the older react-native-reanimated@1.13.2.
Since I’ve tried a lot of combinations and I am not sure how reliable the integrated terminal history of VSCode with PS is, I am not 100% sure if these were the commands. However they might help for future reference.
Besides this seems like “just a temp. fix” so this problem might happen with future versions before we determined the cause.
I have solved this problem. Move on to React Navigation v6 . V6 is mostly same as V5. if not solved than down grade react-native-reanimated to version 1. Don’t forget to start react native project with
npx react-native start --reset-cache
I can’t run any of my applications in react native on my android simulator with reanimated2 (DrawerNavigator throws an error, NativeReanimated not found). Are you sure this new module have ever been tested before commiting?
Can confirm this behaviour. Downgrading throws the same error on my side.
Here are my dependencies:
Also using VSCode on Win 10.
React navigation v5 is not compatible with reanimated 2
I get same error too while using reanimated version 2.0.0 I install version react-native-reanimated": “^1.13.2”. It is working fine.
FYI. I faced same issue while using reanimated version 2.0.0
Version “react-native-reanimated”: “^1.13.2” works fine.