Migrating app from vanilla React Native to Expo - wipes AsyncStorage

Hi

First of all thank you very much for all the great work on Expo, it really does smooth out a lot of the bumps in developing react native apps.

We are in the process of migrating an app from an existing plain react native codebase to Expo in order to take advantage of much easier updates and streamlined workflow that Expo provides. Everything has been going well but we have it a bit of a showstopper bug.

When upgrading an existing Android app (already on the Play store) with the new Expo developed app the AsyncStorage is getting wiped and we are no longer able to access any data that was saved from the existing non-Expo version.

As I understand it as long as the package name is identical then upgrades should preserve the data from the existing installation but this does not seem to be happening on Android.

We have tested the same process but using 2 versions of the app built with expo (upgrading one version over the other), and using 2 versions of the app built just with react-native and the process seems to preserve the data ok, it is only when upgrading from a react-native built app to an expo built app that it fails. I have also used the apk analyser tool from Android Studio and verified that both versions use the same package name in AndroidManifest.xml.

The app is standalone and self hosted and this is only tested on Android so far.

Does anyone know the reason why the data is being wiped?

2 Likes

This would surprise me a bit if it was the case, just because AsyncStorage is a vanilla React Native component, but it’s possible that Expo is prefixing the keys for the storage values with something different than vanilla React Native. I was looking into transferring local data from a previous version in Cordova and found that I couldn’t easily use the SecureStore or SQLite libraries due to Expo-specific prefixes/ file paths. Since we were ejecting for other reasons, anyway, I used a file system module on each side so we could transfer the data in JSON. You would have to look in the source code most likely to see if this is the case.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.