I have just upgraded to Expo SDK 48 and it seems I am logged out after every refresh.
I downgraded back to SDK 47, and everything works as expected.
I am using firebase v9 (v9.17.1), installed with expo install not with yarn.
Steps I followed for upgrading to Expo 48:
- Update to the latest version of EAS CLI: npm i -g eas-cli.
- Install the new version of the Expo package: yarn add expo@^48.0.0
- Upgrade all dependencies to match SDK 48: npx expo install –fix
- Check for any possibly issues in your project dependencies: npx
expo-doctor - Upgraded to the latest version of the firebase web sdk: expo install firebase
- delete node modules, yarn.lock and reinstall everything
What am I missing ?
I could’t find anything on the release notes that can help me.
2
Answers
Take a look at the code where you are capturing the login event (
onAuthStateChanged()
) and how you are caching its results (typically by setting theuser
value in a state variable) and see how your app is behaving when code refreshes are happening.My bet is that this might be a behaviour change in how Expo 48 (or more likely its underlying React or React-Native version) has, but that it isn’t "wrong". Instead, my bet is that your code was "working" under pre-48 but that it wasn’t/isn’t actually correct.
Consider posting some code around where/how you are calling onAuthStateChanged(), and how you are using the value returned by it to render your UI.
I think I found the problem. Firebase uses a deprecated version of AsyncStorage, which apparently was removed in SDK 48.
I was able to fix it (more testing is ongoing) with this:
With the
persistence
node, you tell Firebase to use the "native" AsyncStorage, i.e. the AsyncStorage that is present in current RN apps.