From b5d4ffcd62d63bcce1db92add823401f08d3d847 Mon Sep 17 00:00:00 2001 From: Rui Ying Date: Sun, 5 May 2019 03:04:58 +0800 Subject: [PATCH] Use `@react-native-community/async-storage` --- android/app/build.gradle | 1 + .../io/robertying/learnx/MainApplication.java | 2 ++ android/settings.gradle | 2 ++ ios/Podfile | 2 ++ package.json | 1 + src/redux/store.ts | 2 +- yarn.lock | 15 ++++++--------- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 800cae72..e1807a98 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -193,6 +193,7 @@ android { } dependencies { + implementation project(':@react-native-community_async-storage') implementation project(':react-native-extra-dimensions-android') implementation project(':react-native-interactable') implementation project(':react-native-calendar-events') diff --git a/android/app/src/main/java/io/robertying/learnx/MainApplication.java b/android/app/src/main/java/io/robertying/learnx/MainApplication.java index d9476d4e..eacac6f9 100644 --- a/android/app/src/main/java/io/robertying/learnx/MainApplication.java +++ b/android/app/src/main/java/io/robertying/learnx/MainApplication.java @@ -4,6 +4,7 @@ import com.RNFetchBlob.RNFetchBlobPackage; import com.facebook.react.ReactApplication; +import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; import ca.jaysoo.extradimensions.ExtraDimensionsPackage; import com.wix.interactable.Interactable; import com.calendarevents.CalendarEventsPackage; @@ -52,6 +53,7 @@ public boolean getUseDeveloperSupport() { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new AsyncStoragePackage(), new ExtraDimensionsPackage(), new Interactable(), new CalendarEventsPackage(), diff --git a/android/settings.gradle b/android/settings.gradle index 4e001bd8..1dac0b71 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ apply from: '../node_modules/react-native-unimodules/gradle.groovy' +include ':@react-native-community_async-storage' +project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android') include ':react-native-extra-dimensions-android' project(':react-native-extra-dimensions-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-extra-dimensions-android/android') include ':react-native-interactable' diff --git a/ios/Podfile b/ios/Podfile index 557002e9..d6a79a49 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -54,4 +54,6 @@ target 'learnX' do pod 'Interactable', :path => '../node_modules/react-native-interactable' + pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage' + end diff --git a/package.json b/package.json index 11d61fc7..8c195887 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "postinstall": "chmod +x patch/patch.sh && patch/patch.sh" }, "dependencies": { + "@react-native-community/async-storage": "1.3.4", "@react-native-community/blur": "3.3.1", "dayjs": "1.8.13", "expo-secure-store": "4.0.0", diff --git a/src/redux/store.ts b/src/redux/store.ts index 777714f2..4ea145b6 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -1,7 +1,7 @@ +import AsyncStorage from "@react-native-community/async-storage"; import { applyMiddleware, combineReducers, compose, createStore } from "redux"; import { PersistConfig, persistReducer, persistStore } from "redux-persist"; import createSecureStore from "redux-persist-expo-securestore"; -import AsyncStorage from "redux-persist/lib/storage"; import thunk, { ThunkMiddleware } from "redux-thunk"; import authReducer from "./reducers/auth"; import { mainReducers, rootReducer } from "./reducers/root"; diff --git a/yarn.lock b/yarn.lock index 117ac997..47809320 100644 --- a/yarn.lock +++ b/yarn.lock @@ -799,6 +799,11 @@ "@types/istanbul-lib-coverage" "^2.0.0" "@types/yargs" "^12.0.9" +"@react-native-community/async-storage@1.3.4": + version "1.3.4" + resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.3.4.tgz#5a664484d485bcbab79648e1a0ce775b90843f29" + integrity sha512-fJmzL27x0BEjhmMXPnDPnUNCZK7bph+NBVCfAz9fzHzAamaiOkdUwuL3PvE4Oj4Kw4knP8ocw5VRDGorAidZ2g== + "@react-native-community/blur@3.3.1": version "3.3.1" resolved "https://registry.yarnpkg.com/@react-native-community/blur/-/blur-3.3.1.tgz#bc9ecd6d85d89739d8180138716535ac7cfa4680" @@ -983,15 +988,7 @@ dependencies: "@types/react" "*" -"@types/react@*": - version "16.8.15" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.15.tgz#a76515fed5aa3e996603056f54427fec5f2a5122" - integrity sha512-dMhzw1rWK+wwJWvPp5Pk12ksSrm/z/C/+lOQbMZ7YfDQYnJ02bc0wtg4EJD9qrFhuxFrf/ywNgwTboucobJqQg== - dependencies: - "@types/prop-types" "*" - csstype "^2.2.0" - -"@types/react@16.8.16": +"@types/react@*", "@types/react@16.8.16": version "16.8.16" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.16.tgz#2bf980b4fb29cceeb01b2c139b3e185e57d3e08e" integrity sha512-A0+6kS6zwPtvubOLiCJmZ8li5bm3wKIkoKV0h3RdMDOnCj9cYkUnj3bWbE03/lcICdQmwBmUfoFiHeNhbFiyHQ==