Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/RCTAsyncStorage.expo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
* will likely not be valid anymore, and the package will need to be included in the Expo SDK
* to continue to work.
*/
const {NativeModules} = require('react-native');
const RCTAsyncStorage = NativeModules.AsyncSQLiteDBStorage || NativeModules.AsyncLocalStorage;
const {NativeModules, TurboModuleRegistry} = require('react-native');

export default RCTAsyncStorage;
let RCTAsyncStorage;

// TurboModuleRegistry falls back to NativeModules
// so we don't have to try go assign NativeModules'
// counterparts if TurboModuleRegistry would resolve
// with undefined.
if (TurboModuleRegistry) {
RCTAsyncStorage = TurboModuleRegistry.get("AsyncSQLiteDBStorage") || TurboModuleRegistry.get("AsyncLocalStorage");
} else {
RCTAsyncStorage = NativeModules.AsyncSQLiteDBStorage || NativeModules.AsyncLocalStorage;
}

export default RCTAsyncStorage;