Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InitialRouteName: undefined is not an object in evaluating routeConfigs[InitialRouteName].params

Here is the working code block for createStackNavigator({...}), with the block for initialRouteName being commented out.

const navigator = createStackNavigator(
  {
    Event:  Event,
    Signup: Signup,
    Verif1: Verif1,
    Chat: {
      screen: ChatWithSocket,

    } 
  },  /*{
    initialRouteName: Signup,
  }  */
);

const AppContainer = createAppContainer(navigator);
export default AppContainer;  

The app is running with React Native 0.59.5 and react navigation 3.9.1. If the block for initialRoutesName is enabled (comments removed). then it popup an error:

enter image description here

Based on my reading online, the problem seems to be a config issue with the React Navigation module.

like image 448
user938363 Avatar asked Sep 19 '25 21:09

user938363


2 Answers

I had to switch initalRouteName to initialRouteParams

const navigator = createStackNavigator(
  {
    Event:  Event,
    Signup: Signup,
    Verif1: Verif1,
    Chat: {
      screen: ChatWithSocket,

    } 
  },  {
    initialRouteParams: 'Signup',
  }  
);

const AppContainer = createAppContainer(navigator);
export default AppContainer;  
like image 116
Squirrl Avatar answered Sep 22 '25 12:09

Squirrl


Here is the working code. The name of initial route is a string:

const navigator = createStackNavigator(
  {
    Event:  Event,
    Signup: Signup,
    Verif1: Verif1,
    Chat: {
      screen: ChatWithSocket,

    } 
  },  {
    initialRouteName: 'Signup',
  }  
);

const AppContainer = createAppContainer(navigator);
export default AppContainer;  
like image 28
user938363 Avatar answered Sep 22 '25 12:09

user938363