功能:login 页面点击按钮跳转到 chat 页面,对应 login.js 与 chat.js
login 代码:按钮事件 <Button onPress={() => { console.log(navigate('Chat')) }} title="Sign in" /> login 页面注册路由:StackNavigator({ Chat: {screen: Chat}, Index: {screen: Index}, Login: {screen: Login}, });
注:navigate 已经通过 const {navigate} = this.props.navigation; 接收, navigate ("chat")返回值一直为 false
chat.js 代码: import React, {Component} from 'react'; import {SectionList, FlatList, Text, View, StyleSheet, Image,} from 'react-native';
export default class Chat extends Component{
constructor(props) {
super(props)
}
render() {
return (
<View>
<Text>
Profile
</Text>
</View>
)
}
}
请问以上有什么错误吗?谢谢了
1
aiyov OP 路由所对应的组件也都引入了的
|