0

Is there anyway with react-native-tab-view to not render the tab until it is visible/clicked on?

link: https://github.com/react-native-community/react-native-tab-view

Oatmeal
  • 39
  • 4

1 Answers1

2

i did something like this if it helps:

renderScene = ({ route }) => {
if (route.key == 'scene0' && this.state.index == 0) {
  return <Scene0 />;
}
if (route.key == 'scene1' && this.state.index == 1) {
  return <Scene1 />;
}
if (route.key == 'scene2' && this.state.index == 2) {
  return <Scene2 />;
}

What this allowed me to do was to control when the component was mounted, which is only when the screen is active.

Alex Tarkowski
  • 195
  • 3
  • 11