I am creating an app using React Native where I have a few pages that are only to be displayed when the app is first opened, these pages include selecting language and allowing access to location and notification pages.
How can I make these pages appear only once when the app is first downloaded.
Currently, I am storing all pages in a stack in the main ‘App.js’ file.
<NavigationContainer>
<Stack.Navigator screenOptions={{headerShown:false}}>
<Stack.Screen name='selectLanguage' component={selectLanguage} />
<Stack.Screen name='setLocation' component={setLocation} />
<Stack.Screen name='enableNotifications' component={enableNotifications} />
<Stack.Screen name='HomePage' component={HomePage} />
</Stack.Navigator>
</NavigationContainer>
2
Answers
After navigating to the home screen for the first time set your flag in my case IntroShown to 1
then you app.js will look something like
</Stack.Navigator>
</Stack.Navigator>
)
}
You can probably do something like this