$ npm install react-native-mbaichuan --save
$ react-native link react-native-mbaichuan
- 打开XCode工程中, 右键点击
Libraries
➜Add Files to [your project's name]
- 去
node_modules
➜react-native-mbaichuan
目录添加RNReactNativeMbaichuan.xcodeproj
- 在工程
Build Phases
➜Link Binary With Libraries
中添加libRNReactNativeMbaichuan.a
- 打开
android/app/src/main/java/[...]/MainActivity.java
- 在顶部添加
import com.reactlibrary.RNReactNativeMbaichuanPackage;
- 在
getPackages()
方法后添加new RNReactNativeMbaichuanPackage()
- 打开
android/settings.gradle
,添加:include ':react-native-mbaichuan' project(':react-native-mbaichuan').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mbaichuan/android')
- 打开
android/app/build.gradle
,添加:以及添加compile project(':react-native-mbaichuan')
ndk { abiFilters "armeabi-v7a", "x86" }
- 把
/node_modules/react-native-mbaichuan/ios
下的BaichuanSDK
引入到项目中,并替换yw_1222.jpg
URL Schemes
添加tbopen + 百川APPID
LSApplicationQueriesSchemes
添加tmall
、tbopen
- 记得把examples/ios/BaichuanSDK/mtopsdk_configuration.plist 文件拖到项目中去,否则initSDK失败闪退
- 复制百川安全图片
yw_1222.jpg
到android/app/src/main/res/drawable/yw_1222.jpg
import * as mBaichuan from 'react-native-mbaichuan';
// TODO: What to do with the module?