Reputation: 1313
Is there any configuration in react-navigation for screens I only want to display once during the life time of the app? For instance, once the app is installed for the first time, I want the help screen to appear.
If no configuration is available, then what is the best way to do it? My idea is to save a variable locally and set it once the help screen has been displayed. Once the user opens the app again this variable will be checked and based on the that the next screen will appear. The problem here is that if the user erased the app data (cache and all) then the help screen will appear again even if he is not a first time user.
Any suggestions?
Upvotes: 3
Views: 5941
Reputation: 6136
People change their mobiles and sell the old ones. A new user might install the same application on the same mobile but that user should also see the help page. You can achieve this using 2 methods, one would be server based and one would be local mobile based.
When the user registers or log-ins for the first time show the help page and store that the user has seen the help page on your server. Next time the user reinstalls the application on a new device or the same device check for that information and do not show the help page.
Use React Native's AsyncStorage
and mark the user as help seen. When the user logs-out of the application make sure to remove that key from AsyncStore
so that a new user can see the help page.
My thoughts would be you use the local app based method and let the user see the help page everytime they clear their app data or reinstall the application because features change and you might also change the help page in future. So it is better to let the user see it more than once given that you give the ability to skip the help page as well :)
Upvotes: 5
Reputation: 2638
Using AsyncStorage is probably the best option since it will store data locally on the device and persist between sessions. However, AsyncStorage
data will be erased if the user uninstalls an app.
You can persist data between app installs on iOS by using the Keychain, accessible in React Native via 3rd party libraries (https://github.com/oblador/react-native-keychain)
I don't believe there is any way to persist data between app installs on Android.
Upvotes: 1