Search code examples
react-nativetabnavigatorreact-native-tabnavigator

With React Native, how can I render the second component in my Tab navigation before it is in view?


The second component is very simple and I was wondering if I can render it prior so that there is no load time. Thank you!


Solution

  • You can use TabNavigatorConfig lazy prop.

    Pass lazy={false} so that your views may load at initial start, then you will have not any load time!

    check this:

    const regStack = TabNavigator(
      {
        Login: { screen: Login },
        Register: { screen: Register }
      },
    
      {
        initialRouteName: "Login",
        tabBarPosition: "bottom",
    
        tabBarOptions: {
          activeTintColor: "#F0FFFF",
        },
    
        animationEnabled: true,
        swipeEnabled: true,
        lazy: false 
      }
    );