V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
aiyov
V2EX  ›  问与答

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

  •  
  •   aiyov · 2018-01-16 23:12:37 +08:00 · 1291 次点击
    这是一个创建于 2291 天前的主题,其中的信息可能已经有所发展或是发生改变。

    功能: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 条回复    2018-01-16 23:23:20 +08:00
    aiyov
        1
    aiyov  
    OP
       2018-01-16 23:23:20 +08:00
    路由所对应的组件也都引入了的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2822 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:33 · PVG 23:33 · LAX 08:33 · JFK 11:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.