2

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

  • set a loading screen, and set a timeout so when the timeout is over you move to your mane screen – chikabala Feb 17 '22 at 11:41
  • @chikabala I don't think that's what I need. I need to have 3 screens that navigate from one to another that have some info on them. And it should appear only after first launching an app, not every time you launch it. Thanks for the answer tho :) – Nemanja Mitric Feb 17 '22 at 12:09
  • You need to store a value based on if the user has completed your tasks, using e.g. AsyncStorage or react-native-mmkv-(storage). – Kipnoedels Feb 17 '22 at 13:13
  • @NemanjaMitric i got you now, please check my answer and let me know – chikabala Feb 17 '22 at 14:19

1 Answers1

1

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')
  }
}
chikabala
  • 653
  • 6
  • 24