1

When using startTabBasedApp(params) in React Native Navigation (by Wix), all of the tabs load at once.

Is there a way to make it so that only the initial tab loads? And then only after clicking on another tab does that tab load?

Oatmeal
  • 39
  • 4

2 Answers2

0

I don't believe it's possible. See this comment for more information, it seems like they intended this behaviour.

Peter Nagy
  • 136
  • 6
0

A possible workaround is to use the following within the component:

onNavigatorEvent(event) {
  switch (event.id) {
    case "bottomTabSelected":
      this.setState({ didPressTab: true })
      break
    case "willAppear":
  ApplicationScreensManager.getInstance().registerCurrentActiveScreen(ApplicationScreens.WebViewContainerScreen)
     }
      break
  }
}

while this case "bottomTabSelected": is fired only when selecting a tab, then you can set the state raising a flag and only then do whatever you intended on when pressing the tab.

good luck

Itamar
  • 885
  • 1
  • 9
  • 17