1.0.13 • Published 5 years ago
react-native-shareinstall v1.0.13
react-native-shareinstall
Getting started
$ npm install react-native-shareinstall --save
Mostly automatic installation
$ react-native link react-native-shareinstall
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-shareinstall
and addRNShareinstall.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNShareinstall.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)< 5.ios 功能暂且还没完善,后续会更新,2.0版本会更新完整iOS功能
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNShareinstallPackage;
to the imports at the top of the file - Add
new RNShareinstallPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-shareinstall' project(':react-native-shareinstall').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shareinstall/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-shareinstall')
Windows
- In Visual Studio add the
RNShareinstall.sln
innode_modules/react-native-shareinstall/windows/RNShareinstall.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Shareinstall.RNShareinstall;
to the usings at the top of the file - Add
new RNShareinstallPackage()
to theList<IReactPackage>
returned by thePackages
method
Usage
import RNShareinstallModule from 'react-native-shareinstall';
#该方法用于监听app通过univeral link或scheme拉起后获取唤醒参数
this.receiveWakeupListener = map => {
if (map) {
//do your work here
}
Alert.alert('拉起回调',JSON.stringify(map))
}
RNShareinstallModule.addWakeUpListener(this.receiveWakeupListener)
#该方法用于获取安装参数
RNShareinstallModule.getInstall(10, map => {
if (map) {
//do your work here
}
Alert.alert('安装回调',JSON.stringify(map))
})