TypeError:未定义不是对象(评估“ routeConfigs [initialRouteName] .params”)

时间:2019-12-20 06:25:49

标签: react-native

TypeError:undefined不是一个对象(正在评估“ routeConfigs [initialRouteName] .params”)

import React, { Component } from 'react';
    import {createStackNavigator} from 'react-navigation-stack';
    import { createAppContainer} from 'react-navigation';
    import loginScreen from '../screens/loginscreen';
    import forgotpasswordscreen from '../screens/forgotpasswordscreen';
    const Nevigation = createStackNavigator(
    {
        loginScreen : loginScreen,
        forgotpasswordscreen : forgotpasswordscreen
    },
     {initialRouteName: 'loginscreen'},
    );
    export default createAppContainer(Nevigation);

1 个答案:

答案 0 :(得分:1)

尝试使用此方法来解决该错误。

import React,{Component} from 'react';
import {createStackNavigator} from 'react-navigation-stack';
import { createAppContainer} from 'react-navigation';
import Login from '../Login';
import Forgotpass from '../Forgotpass';
const Navigation = createStackNavigator({
    Login : Login,
    Forgotpass : Forgotpass
},
{initialRouteName:"Login"}
);
export default createAppContainer(Navigation);

正确输入代码Login或Forgotpass Path,然后必须解决错误。