Skip to content

smart load react native image resource both from apk(ipa) and jsbundle Dir.

License

Notifications You must be signed in to change notification settings

smallnew/react-native-smartassets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

before after

$ npm install --save react-native-smartassets

Mostly automatic installation

$ react-native link react-native-smartassets

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-smartassets and add RNSmartassets.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNSmartassets.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. 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

About

smart load react native image resource both from apk(ipa) and jsbundle Dir.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published