Reputation: 4724
I am using tab navigator. And it has thee tabs "Search", "Show as text", "Show on map"
I have a address search box in Search tab. I would like to hide other two tabs if search has not happened yet. So if user hasn't searched any thing other two tabs shouldn't be visible.
Can you please tell me how can I achieve this?
Hiding tabs is a preferred way. Second option is to disable tabs until search is done.
Upvotes: 0
Views: 3831
Reputation: 524
I had used removeChildAt on tab navigator and works fine. But if you want to do specific actions on selected Tab then you should think about other solution because the removedChild is no longer available in tab navigator.
Upvotes: 0
Reputation: 106
There are a couple ways to do this.
Use the TabNavigator's getTabAt() method which returns the Button that makes up the visual tab and set the visible property to false. It can be tricky with bindings.
The other option is to addChildAt or removeChildAt on the TabNavigaor depending on what tabs you want to show or hide.
As you mention disabling could also work. Do this by as well setting the tab's container to disabled.
Upvotes: 7