什么是隐藏在一个TabNavigator容器标签的最佳方式是什么? [英] What's the best way to hide a tab in a TabNavigator?

查看:117
本文介绍了什么是隐藏在一个TabNavigator容器标签的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有条件地隐藏在一个TabNavigator容器标签。看来,设置明显的不正常工作(presumably因为这是如何与TabNavigator隐藏当前未选中的选项卡)。

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 that aren't currently selected).

什么是正确的方式做到这一点?

What's the right way to do this?

推荐答案

您可以通过使用的TabNavigator的getTabAt()方法返回,构成了视觉选项卡按钮的做到这一点。然后,您可以设置该按钮的可见性。这是一个有点棘手得到这个设置了绑定,但它是可行的。

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.

您还可以考虑只禁用选项卡,而不是,您可以通过在相应的TabNavigator儿童(为其可见没工作)设置启用做的。

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).

这篇关于什么是隐藏在一个TabNavigator容器标签的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆