From 9fa8ab9c8ea38a053fc3df5100876aec391ac089 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Mon, 8 Apr 2019 20:05:48 +0200 Subject: [PATCH 1/3] fix: Prefer RNC's AsyncStorage over RN's. React Native's (deprecated) AsyncLocalStorage is being picked up before RNC's. --- lib/AsyncStorage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/AsyncStorage.js b/lib/AsyncStorage.js index 2394bec0..b3404bd1 100644 --- a/lib/AsyncStorage.js +++ b/lib/AsyncStorage.js @@ -14,9 +14,9 @@ const {NativeModules} = require('react-native'); const RCTAsyncStorage = - NativeModules.AsyncLocalStorage || // Support for external modules, like react-native-windows NativeModules.RNC_AsyncSQLiteDBStorage || - NativeModules.RNCAsyncStorage; + NativeModules.RNCAsyncStorage || + NativeModules.AsyncLocalStorage; // Support for external modules, like react-native-windows if (!RCTAsyncStorage) { throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. From 892afed148ad13b436c7c8e2a03fb5f2b965a69c Mon Sep 17 00:00:00 2001 From: Krzysztof Borowy Date: Tue, 9 Apr 2019 19:55:17 +0200 Subject: [PATCH 2/3] fix: Deprecate AsyncStorage from React Native (#66) From recent changes, we've moved back to add `LocalAsyncStorage` native module, which consequently fallbacks to deprecated Async Storage on RN Core. This change reverts this back and add new name, to be used by external storages. --- lib/AsyncStorage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AsyncStorage.js b/lib/AsyncStorage.js index b3404bd1..ef4d1b2f 100644 --- a/lib/AsyncStorage.js +++ b/lib/AsyncStorage.js @@ -16,7 +16,7 @@ const {NativeModules} = require('react-native'); const RCTAsyncStorage = NativeModules.RNC_AsyncSQLiteDBStorage || NativeModules.RNCAsyncStorage || - NativeModules.AsyncLocalStorage; // Support for external modules, like react-native-windows + NativeModules.PlatformLocalStorage; // Support for external modules, like react-native-windows if (!RCTAsyncStorage) { throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. From e2a58a4ac4b26db0c5e87f9342f63a5d20e94144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caio=20Alc=C3=A2ntara?= Date: Wed, 10 Apr 2019 07:39:01 +0100 Subject: [PATCH 3/3] docs: Update iOS Linking information (#61) After the discussions on issue #56 I've noticed that we have missing information about iOS Linking and almost none about the manual linking process, this PR aims to provide this missing info. --- README.md | 7 ++++++- docs/Linking.md | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4834268c..4137f04d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ $ react-native link @react-native-community/async-storage See docs for [manual linking guide.](docs/Linking.md) +**Note:** For iOS project using `pods`, run: + ``` + $ cd ios/ && pod install + ``` + ## Usage @@ -66,4 +71,4 @@ See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out. ## License -MIT \ No newline at end of file +MIT diff --git a/docs/Linking.md b/docs/Linking.md index ff345be6..0dd9326d 100644 --- a/docs/Linking.md +++ b/docs/Linking.md @@ -2,6 +2,27 @@ ## iOS +#### Project linking +1. Open your project `.xcodeproj` on xcode. + +2. Right click on the Libraries folder and select `Add files to "yourProjectName"`. + +3. Add `RNCAsyncStorage.xcodeproj` (located at `node_modules/@react-native-community/async-storage/ios`) to your project Libraries. + +3. Go to `Build Phases -> Link Binary with Libraries` and add: `libRNCAsyncStorage.a`. + +#### Using 'Pods' +1. Enter into iOS Folder `cd ios/` (on your project's root folder). + +2. Add this line to your `Podfile` just below the last pod: (if you don't one just create a new runnning: `pod init`). + +```diff ++ pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage' +``` + +3. Run `pod install` + + ## Android 1. Add project to `android/settings.gradle`: ```diff