reactNative(StackNavigator 路由跳转不动),求指教

2018-01-16 23:12:37 +08:00
 aiyov

功能: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>
                                 )
                              }
               }

请问以上有什么错误吗?谢谢了

1298 次点击
所在节点    问与答
1 条回复
aiyov
2018-01-16 23:23:20 +08:00
路由所对应的组件也都引入了的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/423476

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX