React Native 状态使用Redux控制,怎么根据状态判断执行Navigator跳转

场景是一个登录,判断状态执行Navigator跳转

问题是,跳转后 页面会重复跳转至少两次,不知道哪里写错了。

    shouldComponentUpdate(nextProps, nextState){

        if(nextProps.user.isLoggedIn != this.props.isLoggedIn && nextProps.user.isLoggedIn == true) {
            this.props.router.toAccount();
            return false;
        }
        
        if(nextProps.loginStatus == 'doing' || nextProps.loginStatus == 'error' || nextProps.loginStatus == 'done') {
            return false;
        }

        return true;
    }
阅读 2.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题