The goal: stop sending images over the React Native bridge! Instead, store them in the native-side image store and use rn-fetch-blob to upload directly from native
iOS/Android normalization for https://facebook.github.io/react-native/docs/imagestore.html
Use this on the JS/native side to store images in native cache
$ npm install react-native-image-store --save
$ react-native link react-native-image-store
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-image-store
and addRNImageStore.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNImageStore.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import io.tradle.reactimagestore.RNImageStorePackage;
to the imports at the top of the file - Add
new RNImageStorePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-image-store' project(':react-native-image-store').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-store/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-image-store')
iOS/Android normalization for https://facebook.github.io/react-native/docs/imagestore.html