react-navigation:隐藏标签栏动画很慢

时间:2019-09-10 12:03:58

标签: javascript react-native react-navigation

我有一个bottomTabNavigator,在bottomTabNavigator内嵌套了一个stackNavigator

const ButtomTabNavigator = createBottomTabNavigator({
  MyProfile:{
    screen:MyPageStack,
    navigationOptions : {
      tabBarLabel:'MyProfile',
      tabBarIcon:({tintColor}) =>(
        <Image style={{ width: 18, height: 18,tintColor:tintColor }}
        source={require('./Components/Assets/iconMyMint.png')}
        />
      ),
    }
  },
  Customer:{
    screen:CustomerStack,
    navigationOptions : {
      tabBarLabel:'Customer',
      tabBarIcon:({tintColor}) =>(
        <Image style={{ width: 18, height: 18,tintColor:tintColor }}
        source={require('./Components/Assets/iconCsGrey.png')}
        />
      ),
    }
  },
  Booking:{
    screen:MyBookStatus,
    navigationOptions : {
      tabBarLabel:'Booking',
      tabBarIcon:({tintColor}) =>(
        <Image style={{ width: 18, height: 18,tintColor:tintColor }}
        source={require('./Components/Assets/grey.png')}
        />
      ),
    }
  },
},
{
  tabBarOptions: {
    activeTintColor: '#16bb92',
  },
  shifting:true,
})

当我在stackNavigator中时,我隐藏了bottomTabNavigator。

MyPageStack.navigationOptions = ({ navigation }) => {
  let tabBarVisible;
  if (navigation.state.routes.length > 1) {
    tabBarVisible = false;
  } else {
    tabBarVisible = true;
  }
  return {
    tabBarVisible
  }
} 

一切正常。我没有看到bottomTabbar,但是当我导航到另一个屏幕时,动画无法顺利播放其laggy

知道为什么会这样吗?

任何评论或建议都会很有帮助。

提前谢谢! :)

0 个答案:

没有答案