react-native-insider
v6.6.0-nh
Published
React Native Insider SDK
Downloads
9,124
Readme
react-native-insider
Getting started
$ yarn add react-native-insider —-save
Automatic installation (Recommended)
$ react-native link react-native-insider
Manual installation (Optional)
Skip this step if you performed the automatic installation successfully.
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-insider
and addRNInsider.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNInsider.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.useinsider.react.RNInsiderPackage;
to the imports at the top of the file - Add
new RNInsiderPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-insider' project(':react-native-insider').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-insider/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-insider')
Native Integration Steps (Required)
iOS
- From the left-side navigation of XCode, select your project. Add
libsqlite3.0.tbd
andlibicucore.tbd
to your project'sBuild Phases
➜Link Binary With Libraries
- In order to use push notification service from Apple, first you need to enable Push Notification. Select your project and navigate to
Targets
➜Capabilities
. EnablePush Notifications
from the list. Then locateBackground Modes
and checkRemote Notifications
andBackground Fetch
.
Android
- Append the following lines to
android/build.gradle
(Project Level Gradle):
buildscript{
dependencies{
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects{
repositories{
maven { url 'https://mobile.useinsider.com'}
}
}
- Append the following lines to
android/app/build.gradle
(Module Level Gradle):
//Replace the placeholder partnerName with your actual partner name.
android{
defaultConfig{
manifestPlaceholders = [ partner : 'partnerName']
}
}
//Place the snippet between dependencies and copyDownloadbleDepsToLibs,
//which is nearly the very bottom of the file.
apply plugin: 'com.google.gms.google-services'
- Delete the following line from
android/app/src/AndroidManifest.xml
:
android:allowBackup="false"
Usage
Open up the component registered to the AppRegistery.
// Import RNInsider to access the SDK methods.
import RNInsider from 'react-native-insider';
// Call init function from the main component's componentDidMount.
componentDidMount(){
RNInsider.init("partnerName", "senderID", pushCollapse);
}
"partnerName" => String - Your Partner Name
The next three variables are for Android integration.
"senderID" => String - Your Sender ID that you retrieved from Firebase console.
"pushCollapse => boolean - This enables or disables overwriting of Push Notifications in the Notification Drawer.