rn-smartassets
v1.0.4
Published
Smart load react native image resource both from apk(ipa) and jsbundle Dir.
Downloads
2
Readme
react-native-smartassets
Getting started
Smartassets change the react native image load logic by hook defaultAsset method.
Smartassets let your app can load image form apk(ipa in iOS case) and filesystem with smart choose.
$ npm install --save react-native-smartassets
Mostly automatic installation
$ react-native link react-native-smartassets
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-smartassets
and addRNSmartassets.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNSmartassets.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.smallnew.smartassets.RNSmartassetsPackage;
to the imports at the top of the file - Add
new RNSmartassetsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-smartassets' project(':react-native-smartassets').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-smartassets/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-smartassets')
Usage
import {SmartAssets} from 'react-native-smartassets';
SmartAssets.initSmartAssets();
SmartAssets.setiOSRelateMainBundlePath(youOriginJsBundlePath);//optional