How to make screens appear only after installation in react native expo

886 Views Asked by At

I have a few welcome screens that should only appear once, when the app is first launched after installation, but I have no idea how.

My app is in react-native 0.64.3 and expo 43.0.2

Thank you in advance

1

There are 1 best solutions below

0
On BEST ANSWER

AsyncStorage will do the job for you, you can use it along with componentDidMount

async componentDidMount() {
  const firstTime = await AsyncStorage.getItem("isFirstTime")
  if(firstTime != null) {
    // navigate to HomePage directly
  } else {
    // navigate to other screens where you have some infos to show
    await AsyncStorage.setItem("isFirstTime", 'true')
  }
}