我正在尝试使用Stack导航,我遵循了文档,但是它始终抛出:“空不是对象”错误,我不明白是什么问题。我看过的所有代码基本上都与此代码相同,我是否缺少某些内容?
App.js文件:
import {Platform, StyleSheet, Text, View} from 'react-native';
import {
createStackNavigator, createAppContainer
} from 'react-navigation';
import TabNavigation from './Navigation/TabNavigation';
import LoginScreen from './Screens/LoginScreen';
import InterventionScreen from './Screens/InterventionsScreen'
const RootStack = createStackNavigator(
{
LoginScreen: {
screen: LoginScreen
},
TabNavigation: {
screen: TabNavigation
}
},
{
initialRouteName: 'LoginScreen',
}
);
const MyApp = createAppContainer(RootStack);
export default MyApp;
import React from 'react';
import {
StyleSheet,
View,
Text,
} from 'react-native';
export default class InterventionsScreen extends React.Component {
render() {
return(
<View style={styles.container}>
<Text> Navigation </Text>
</View>
);
}
}
我关注了该文档,但该文档不起作用,确切的错误是: null不是对象(评估'RNGestureHandlerModule.State')