导航道具未定义(反应导航)

时间:2019-10-05 16:54:10

标签: react-native react-navigation react-navigation-stack

我只是想学习React导航。我在下面安装了软件包;

expo install react-navigation react-native-gesture-handler react-native-reanimated react-native-screen

然后我尝试放置一个按钮并使用它进行导航,但是

onPress={() => this.props.navigation.navigate('Example')}

我的项目在“道具”之后不能识别“导航”?我安装的所有软件包仍然相同

app.js文件:

import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import Chat from './screens/Chat.js';
import Home from './screens/Home.js'

const RootStack = createStackNavigator({
  Home: Home,
  Chat: Chat
});
const AppContainer = createAppContainer(RootStack);
export default AppContainer;

感谢您的帮助

0 个答案:

没有答案