expo / ex-navigation

Route-centric navigation for React Native
997 stars 201 forks source link

iOS calling jumpToTab programmatically doesn't work unless you click on the tab button #465

Closed thomasttvo closed 7 years ago

thomasttvo commented 7 years ago

On TabNavigation example

In RootNavigation, assign an id to the TabNavigation component

render() {
    return (
+      <TabNavigation id="rootTabNavContext" 

put this code in the HomScreen constructor

  GLOBAL.homeScreen = this;

run this code in the debug console

  homeScreen.props.navigation.getNavigator('rootTabNavContext').jumpToTab('links');

Nothing happens. Inspector showed this would go through all the steps ok, no error was recorded. Now if you press anywhere on the screen, the tab will switch immediately.

thomasttvo commented 7 years ago

I realized this only happens when you run it from the debug console. If you trigger the tab switching code by performing a user action (such as clicking on a Touchable), then the tab switches ok.