Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native undefined不是对象(正在计算'routeconfigs initialroutename.params')_React Native - Fatal编程技术网

React native undefined不是对象(正在计算'routeconfigs initialroutename.params')

React native undefined不是对象(正在计算'routeconfigs initialroutename.params'),react-native,React Native,我真的不明白我的代码有什么问题,有人能帮我吗 我的代码: import React from 'react'; import { StyleSheet, Text, View, Button } from 'react-native'; import {createStackNavigator} from 'react-navigation-stack'; import { createAppContainer } from 'react-navigation'; const MainNav

我真的不明白我的代码有什么问题,有人能帮我吗

我的代码:

import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import {createStackNavigator} from 'react-navigation-stack';
import { createAppContainer } from 'react-navigation';


const MainNavigator = createStackNavigator({
  Home: {screen: () => HomeScreen},
  Profile: {screen: () => ProfileScreen},
},
{
  initialRouteName : 'RouteNameOne',
}
);

const App = createAppContainer(MainNavigator);

class HomeScreen extends React.Component {
  static navigationOptions = {
    title: 'Welcome',
  };
  render() {
    const {navigate} = this.props.navigation;
    return (
      <Button
        title="Go to Jane's profile"
        onPress={() => navigate('Profile', {name: 'Jane'})}
      />
    );
  }
}

class ProfileScreen extends React.Component {
  static navigationOptions = {
    title: 'Welcome',
  };
  render() {
    const {navigate} = this.props.navigation;
    return (
      <Button
        title="Go to Home"
        onPress={() => navigate('Home', {name: 'Jane'})}
      />
    );
  }
}



export default App;
stackNavigator中未定义RouteNameOne

  initialRouteName : 'RouteNameOne',
改为

initialRouteName : 'Home',