Is it possible to retrieve AsyncStorage data when migrating from vanilla RN to Expo?


I’m trying to do the opposite of eject, i.e. move from a vanilla React Native app to a managed Expo app.

  1. Is there a guide for how to do this in general?
  2. In particular, is there a way to retrieve local user data that was previously stored in AsyncStorage in users’ devices?

For example:

Start off with a bare React Native app and run the following:

  • AsyncStorage.setItem('foo', 'bar')
  • await AsyncStorage.getItem('foo') // output is bar, as expected

Convert the app to a managed Expo app (same bundleIdentifier / package) and run the following

  • await AsyncStorage.getItem('foo') // empty

i.e. whatever data was saved to AsyncStorage in vanilla RN is no longer accessible when I migrate to Expo.

It seems like Expo’s AsyncStorage is fetching from ${FileSystem.documentDirectory}/RCTAsyncLocalStorage/manifest.json, and FileSystem.documentDirectory is something along the lines of Documents/ExponentExperienceData/some-function-of-expo-user-and-slug, i.e. a new directory. I imagine there’s a way to migrate the data from the “normal” AsyncStorage dir that was used by vanilla RN to here.

Any updates? I guess it doesn’t have to be AsyncStorage in particular (can migrate data to expo-secure-store or expo-sqlite) – generally just wondering what would be the recommended approach if I want to migrate from a bare RN app to a managed Expo app while being able to recover local data on users’ devices.