import React, {Component} from 'react';
import {View} from 'react-native';
import { createStackNavigator,createAppContainer } from 'react-navigation';
import Splash from './Components/Splash';
import MainScreen from './Components/MainScreen';
const BasedNavigator=createStackNavigator({
Splash:Splash,
MainScreen:MainScreen,
},
{
initialRouteName: 'Splash',
}
)
const Container=createAppContainer(BasedNavigator);
class App extends Component {
render() {
return (
<View style={styles.container}>
<Container />
</View>
);
}
}
const styles = {
container: {
flex: 1,
},
};
export default App;
当我添加react navigation@4.02时,它开始崩溃..我在react-navigation@4.02之前使用它,对于@ 4.02之后我现在可以正常使用了,我现在不明白为什么它不起作用
答案 0 :(得分:1)
版本4中有一些迁移。
例如,createStackNavigator迁移到了react-navigation-stack库。
您必须再次阅读文档:)
https://reactnavigation.org/docs/en/getting-started.html
https://reactnavigation.org/docs/en/hello-react-navigation.html
答案 1 :(得分:0)
使用模块后出现相同的错误
"react-native-gesture-handler": "^1.6.0",
"react-native-reanimated": "^1.7.0",
"react-native-screens": "^2.0.0-beta.8",
请尝试
$ react-native link react-native-gesture-handler
$ react-native link react-native-reanimated
$ react-native link react-native-screens
该解决方案对我有用。
另一个原因可能是