I have ben trying to create a mobile app with a Drawer with React Native.
I did everything what the document says.
Everything works fine except when i try to use;
import { createDrawerNavigator } from "@react-navigation/drawer";
const Drawer = createDrawerNavigator();
react-navigation drawer makes my app go crazy, and I’ve been searching online to fix it but literary there are no answers for this.
Full Error:
Error: Exception in HostFunction: expected 0 arguments, got 1, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
versions:
"@react-navigation/drawer": "^6.6.7",
"react-native-gesture-handler": "^2.15.0",
"react-native-reanimated": "^3.7.0"
2
Answers
Add ‘react-native-reanimated/plugin plugin’ to your ‘babel.config.js’.
module.exports = {
};
For more details follow: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/
After that you need to restart metro server by running ‘yarn start –reset-cache’ and then re run your apps.
For me downgrading the react-native-gesture-handler to 2.14.0 and react-native-reanimated to 3.6.2 worked, will for fix to updated these