1、在入口组件render方法中返回<Navigator>
            let defaultName = 'Welcome';
            let defaultCompenent = Welcome;            
            <Navigator
                initialRoute={{name:defaultName,component:defaultCompenent}}
                /*configureScene={
                    (route) => {
                        //页面转跳动画 node_modules/react-native/Libraries/CustomComponent/navigate/
                        return Navigator.SceneConfig.VerticalDownSwipeJump;
                    }
                }*/
                renderScene={
                    (route,navigator)=>{
                        let Component = route.component;
                        return <Component {...route.params} navigator={navigator}></Component>;
                    }
                }
            />
        2、在Welcom组件的点击事件中修改转跳页面信息并添加参数
            pressButton(){
                const {navigator} = this.props;                
                const self = this;
                /* 上文中,<Component {...route.params} navigator={navigator} 中传递了navigator作为props */
                if(navigator){
                    navigator.push({
                        name: 'Detail',
                        component: Detail,                
                        params:{
                            author:this.state.author,
                            user:this.props.user,
                            getResult: function(res){
                                self.setState({
                                    result:res
                                })
                            }
                        }
                    })
                }
            }
        3、在Detail组件中携带参数返回
            (1)、接收参数
                //生命周期方法
                componentDidMount(){
                    this.setState({
                        author:this.props.author,
                        user:this.props.user
                    });
                }
            (2)、携带参数返回
                backButton(){
                    const {navigator} = this.props;
                    
                    if(this.props.getResult){
                        let result = USER_MODELS[1];
                        this.props.getResult(result);
                    }
                    
                    if(navigator){
                        // 入栈出栈,把当前页面pop掉
                        navigator.pop();
                    }
                }

最新文章

  1. JavaScript之父Brendan Eich,Clojure 创建者Rich Hickey,Python创建者Van Rossum等编程大牛对程序员的职业建议
  2. Python--增量循环删除MySQL表数据
  3. Centos6.5 SVN服务器 搭建及配置
  4. Python自动化 【第十篇】:Python进阶-多进程/协程/事件驱动与Select\Poll\Epoll异步IO
  5. 查看进程的io
  6. 5、XML(1)
  7. ORACLE 重置SEQQUENCE
  8. 《Linux系统静态路由和火墙路由》
  9. Android Studio学习随笔-UI线程阻塞以及优化
  10. (记录前面算过的后面仍然会用的数减小复杂度)A - AC Me
  11. Tomcat 启动报错:javax.naming.NamingException: No naming context bound to this class loader
  12. elasticsearch系列(五)score
  13. 【LeetCode】258. Add Digits
  14. angular路由守卫
  15. 安卓startActivityForResult用法
  16. Top Page
  17. .net core实践系列之短信服务-Sikiro.SMS.Api服务的实现
  18. 注解(Annotation)
  19. IntelliJ IDEA SVN
  20. 74.VS2013和opencv3.1.0安装教程

热门文章

  1. .Net框架的模块代码生成器--其三(dotnet tool指令的参数)
  2. jmeter-json提取器提取的内容含”引号
  3. 解决visual studio 2013编译过程中存在的无法打开kernel.lib问题
  4. Win10多用户同时登陆远程桌面
  5. Eclipse 如何添加 更换字体(转载)
  6. Q函数和值函数
  7. 2020qbxt游记
  8. excel的count、countif、sunif、if
  9. 在VS的依赖项中引用项目
  10. 将smarty安装到MVC架构中