Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined is not an object options.routeGetIdList[action.payload.name]

When navigating to another page it gives an undefined error. Normally no changes have been made.I deleted node_modules and reinstalled. I reset the codes. I deleted the project and restarted. but there was no solution.

TypeError: undefined is not an object (evaluating 'options.routeGetIdList[action.payload.name]')

import { Button, View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

function HomeScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <Button
        title="Go to Details"
        onPress={() => navigation.navigate('Home')}
      />
    </View>
  );
}

function DetailsScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Details Screen</Text>
    </View>
  );
}

const Stack = createStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName="Home">
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
export default App;
    "@react-native-async-storage/async-storage": "^1.13.2",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/datetimepicker": "^3.0.9",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-firebase/admob": "^7.6.12",
    "@react-native-firebase/analytics": "^8.0.1",
    "@react-native-firebase/app": "^9.0.0",
    "@react-native-firebase/firestore": "^7.10.3",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.12.6",
    "emoji-regex": "^9.2.1",
    "firebase": "^8.0.1",
    "grapheme-splitter": "^1.0.4",
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-onesignal": "^3.9.2",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.17.1",
    "react-native-snapchat-login": "^1.1.1",
    "react-native-vector-icons": "^7.1.0"
  },```
like image 926
Batuhan Kerim Türk Avatar asked Feb 03 '21 17:02

Batuhan Kerim Türk


Video Answer


2 Answers

Go to node_modules\@react-navigation\routers\src\StackRouter.tsx

And do the change as below in line 261 and 368

options.routeGetIdList to options.routeNames

This fixed my issue

like image 176
Kavidu Aloka Kodikara Avatar answered Oct 18 '22 05:10

Kavidu Aloka Kodikara


The same error was occurring to me when navigating to another screen, to resolve it I just updated the following dependencies to the latest version:

@react-navigation/native

@react-navigation/stack

Then I cleared the cache and ran the project:

cd android && gradlew clean && cd .. && react-native run-android
like image 23
Kalebe Samuel Avatar answered Oct 18 '22 03:10

Kalebe Samuel