欢迎来到蕾蕾的博客

createBottomTabNavigator: 怎么在切换tab的时候让页面重新渲染

1.import withNavigationFocus from react-navigation to your class .

2.hen export your like this : export default withNavigationFocus(yourclassname)

3.use this code to update or manage your state:

 shouldComponentUpdate = (nextProps, nextState) => {
if (nextProps.isFocused) {
  ...
  return true;
} else {
  ...
  return false;
}

};

 

posted @ 2019-10-15 15:57  蕾蕾是个程序员  阅读(1162)  评论(0编辑  收藏  举报