How do I set UserDefaults from Expo

I’m migrating an app from Expo to Native by overwriting it, and I need to persist user data saved with AsyncStorage.

It appears AsyncStorage actually saves to NSFileManager, not UserDefaults, and I’m at a loss as how to access the data there. When I look at UserDefaults, all I see related to Expo is ExpoPermissions, EXDeviceInstallUUIDKey and RCTDevMenu.

React Native comes bundled with “Settings” which does store to UserDefaults but it appears not to work in an Expo Managed App (RTCSettingsManager)? Is there an alternative method?

Or is there a recommendation as to how to persist data from a managed app to a native install?

1 Like

You could write the data using the FileSystem API, which is probably the most straightforward approach. Alternatively, you could copy the logic from AsyncStorage and use its storage approach in your app.

1 Like

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