我在尝试运行简单的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",
您似乎忘记了将LoginScreen
导入到App.js
文件中。希望有帮助,干杯。