react-native-router-flux

  1. 回退层级到组tab中的某一个
//结构
   <Scene tabs key={"RootTabs"}>
 <Scene key={"Mine"}
                               icon={TabIcon}
                               tabTitle={"我的"}
                               navTransparent
                               renderRightButton={SettingBtn}
                               onEnter={Mine.onEnter}
                               tabIconName={TabIconPath.Mine}
                               component={Mine}/>
</Scene>
//注意 子tab一定要加_
Actions.popTo("_Mine");
  1. 刷新某个页面
//一定要传个新值
Actions.refresh({
            enterTime: new Date()
        });
//在组件接收到新的props生命周期中刷新
 componentWillReceiveProps(nextProps) {
        if (this.props.enterTime !== nextProps.enterTime) {
            const mine: Mine = this.refs.mine["wrappedInstance"];
            mine.onEnter();
        }
    }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容