0

尝试运行简单的 stackNavigator 时出现错误“(0,_reactnavigation.createStackNavigator)”......有人可以帮忙吗?

错误发生在 const AppStackNavigator = createStackNavigator (....它的值为零

 1. simple login screen

        import { View, Text, Card, Button } from 'react-native';
        import React from 'react';

        class LoginScreen extends React.Component {
          render() {
            return (
              <View>
                <Text>Hello Login</Text>
              </View>
            );
          }
        }
        export default LoginScreen;

2. App.js

    import { createStackNavigator } from 'react-navigation';

    class App extends React.Component {
      render() {
            return (
          <View>
            <AppStackNavigator />
          </View>
        );
      }
    }

    const AppStackNavigator = createStackNavigator({
      Login: { screen: LoginScreen },
    });

       export default App;

3. package.json

"react": "16.3.1",
"react-native": "^0.55.4",
"react-navigation": "^2.5.5",
4

1 回答 1

0

看起来您忘记将 导入LoginScreenApp.js文件中。希望有帮助,加油。

于 2018-12-16T22:19:45.747 回答