How Do I Solve React Native Navigation.navigate Error
It's my first time using react native and I want to move to another screen (slide2), I have an error which reads 'Undefined is not an object (evaluating navigation.navigate)' I am
Solution 1:
Your index.js file is incorrect just replace index.js file with this
import 'react-native-gesture-handler';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
you should register App as AppRegistry component instead you are registering SlideOne
Solution 2:
You didn't init your "navigation" const. try this : - Import useNavigation from @react-navigation/native
import { useNavigation } from '@react-navigation/native';
And init your navigation const like this
const navigation = useNavigation();
Post a Comment for "How Do I Solve React Native Navigation.navigate Error"