Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Expo managed workflow supported native backend
/src/RCTAsyncStorage.expo.js @brentvatne
7 changes: 1 addition & 6 deletions src/AsyncStorage.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@

'use strict';

const {NativeModules} = require('react-native');

const RCTAsyncStorage =
NativeModules.PlatformLocalStorage || // Support for external modules, like react-native-windows
NativeModules.RNC_AsyncSQLiteDBStorage ||
NativeModules.RNCAsyncStorage;
import RCTAsyncStorage from './RCTAsyncStorage';

if (!RCTAsyncStorage) {
throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
Expand Down
13 changes: 13 additions & 0 deletions src/RCTAsyncStorage.expo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Expo managed apps don't include the @react-native-community/async-storage
* native modules yet, but the API interface is the same, so we can use the version
* exported from React Native still.
*
* If in future releases (eg: @react-native-community/async-storage >= 2.0.0) this
* 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;

export default RCTAsyncStorage;
8 changes: 8 additions & 0 deletions src/RCTAsyncStorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const {NativeModules} = require('react-native');

const RCTAsyncStorage =
NativeModules.PlatformLocalStorage || // Support for external modules, like react-native-windows
NativeModules.RNC_AsyncSQLiteDBStorage ||
NativeModules.RNCAsyncStorage;

export default RCTAsyncStorage;