-
Open your project
.xcodeprojon xcode. -
Right click on the Libraries folder and select
Add files to "yourProjectName". -
Add
RNCAsyncStorage.xcodeproj(located atnode_modules/@react-native-community/async-storage/ios) to your project Libraries. -
Go to
Build Phases -> Link Binary with Librariesand add:libRNCAsyncStorage.a.
-
Enter into iOS Folder
cd ios/(on your project's root folder). -
Add this line to your
Podfilejust below the last pod (if you don't have one, you can create it by runningpod init):
+ pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'- Run
pod install
- Add project to
android/settings.gradle:
rootProject.name = 'MyApp'
include ':app'
+ 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')- In
android/app/build.gradleadd to dependencies:
dependencies {
...
+ implementation project(':@react-native-community_async-storage')
}- Then, in
MainApplication.java:
package com.myapp;
+ import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
+ new AsyncStoragePackage()
);
}