为了账号安全,请及时绑定邮箱和手机立即绑定

React-Native中使用react-navigation,A跳转到B时未触发A

React-Native中使用react-navigation,A跳转到B时未触发A

眼眸繁星 2019-03-08 14:11:07
在React-Native的项目中使用组件react-navigation进行页面路由管理,在A组件的componentDidMount中开启一个定时器,并在componentWillUnmount中进行清除。A页面使用this.props.navigation.navigate('B')跳转到B页面后,发现componentWillUnmount未被执行对于该组件的问题网上有如下回答:Navigator uses stack to manager route. When you push a new page,current page wont unmount, if you pop from new page to the currentpage, the new page will unmount. And in other scene, if you rendersome child component based on some regulation like isLoading or other,the componentWillUnmount method will also be called when they nolonger need to be rendered.react-navigation组件中存在这样的天然缺陷,不知各位如何应对componentWillUnmount生命周期未调用的场景
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 1619 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信