Reputation: 11
Adding Navigation container and navigators to nx monorepo react native project is giving this error even after installing reactnative gesturehandler:
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.
import React from 'react';
import { StyleSheet, SafeAreaView } from 'react-native';
import { theme } from '@NxDemo/theme';
import { HomeScreen, Profile } from '@NxDemo/ui-components';
import { AppNavigationContainer, TabNavigator } from '@NxDemo/navigation';
const App = () => {
return (
<SafeAreaView style={styles.container}>
<AppNavigationContainer>
<TabNavigator
screens={[
{ name: 'Home', component: HomeScreen },
{ name: 'Profile', component: Profile },
]}
initialRouteName="Home"
/>
</AppNavigationContainer>
</SafeAreaView>
);
};
export default App;
This is my metro.config.js file
const { withNxMetro } = require('@nx/react-native');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const defaultConfig = getDefaultConfig(__dirname);
const { assetExts, sourceExts } = defaultConfig.resolver;
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const customConfig = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg'],
},
};
module.exports = withNxMetro(mergeConfig(defaultConfig, customConfig), {
// Change this to true to see debugging info.
// Useful if you have issues resolving modules
debug: false,
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
extensions: [],
// Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
watchFolders: [],
});
I want to add Tab navigation to nx monorepo react native project and this error is coming up: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary.
I already have "react-native-gesture-handler": "^2.16.2", this dependency in package.json
Upvotes: 1
Views: 487