What's the best way to hide a tab in a TabNavigator?

后端 未结 3 1368
时光取名叫无心
时光取名叫无心 2021-02-15 05:26

I\'d like to conditionally hide a tab in a TabNavigator. It seems that setting visible doesn\'t work properly (presumably because this is how the TabNavigator hides the tabs th

3条回答
  •  猫巷女王i
    2021-02-15 05:58

    You can do this by making use of TabNavigator's getTabAt() method which returns the Button that makes up the visual tab. You can then set that Button's visible property. It's a little tricky to get this setup with a bindings, but it's doable.

    You could also consider just disabling the tab instead, which you can do by setting enabled on the corresponding TabNavigator child (for which visible didn't work).

提交回复
热议问题