From 319cc0d796c7415a65e3ca9a87b58fca187bc918 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Fri, 22 May 2020 14:50:00 -0700 Subject: [PATCH 1/4] Add a .expo.js file to use the built-in react-native RCTAsyncStorage until RNC module ships with it --- src/AsyncStorage.native.js | 7 +------ src/RCTAsyncStorage.expo.js | 13 +++++++++++++ src/RCTAsyncStorage.js | 8 ++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/RCTAsyncStorage.expo.js create mode 100644 src/RCTAsyncStorage.js diff --git a/src/AsyncStorage.native.js b/src/AsyncStorage.native.js index 647278de..b87e0bd0 100644 --- a/src/AsyncStorage.native.js +++ b/src/AsyncStorage.native.js @@ -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. diff --git a/src/RCTAsyncStorage.expo.js b/src/RCTAsyncStorage.expo.js new file mode 100644 index 00000000..3ce3183f --- /dev/null +++ b/src/RCTAsyncStorage.expo.js @@ -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; \ No newline at end of file diff --git a/src/RCTAsyncStorage.js b/src/RCTAsyncStorage.js new file mode 100644 index 00000000..eb2356e1 --- /dev/null +++ b/src/RCTAsyncStorage.js @@ -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; \ No newline at end of file From d343f795b7e54440675c9227d2c9d7bd61cc4b88 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Fri, 22 May 2020 14:55:01 -0700 Subject: [PATCH 2/4] Publish alpha --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d916b05..e19f63ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/async-storage", - "version": "1.10.3", + "version": "1.11.0-alpha.0", "description": "Asynchronous, persistent, key-value storage system for React Native.", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", From 7daaf48b28a0e2302cd0aeb549abe1144e2649c9 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Fri, 22 May 2020 15:30:28 -0700 Subject: [PATCH 3/4] Add CODEOWNERS for RCTAsyncStorage.expo.js --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..7adc5e50 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Expo managed workflow supported native backend +/src/RCTAsyncStorage.expo.js @brentvatne \ No newline at end of file From ce6aae3708aeaa6558075b8076663e2ba869b5bf Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Sat, 23 May 2020 12:59:03 -0700 Subject: [PATCH 4/4] Revert "Publish alpha" This reverts commit d343f795b7e54440675c9227d2c9d7bd61cc4b88. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e19f63ad..4d916b05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/async-storage", - "version": "1.11.0-alpha.0", + "version": "1.10.3", "description": "Asynchronous, persistent, key-value storage system for React Native.", "main": "lib/commonjs/index.js", "module": "lib/module/index.js",