React-Native-sift
Docs
Follow our docs here https://sift.com/developers/docs
Installation:
by yarn
yarn add react-native-sift
by npm
yarn add react-native-sift
Android
1- Also add the project to your settings.gradle:
include ':react-native-sift'
project(':react-native-sift').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sift/android')
2- add dependency in app/build.gradle
implementation project(':react-native-sift')
3- add these lines in android/app/src/[...]/MainApplication.java
import com.reactnativesift.siftmodule.SiftModulePackage;
//...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SiftModulePackage(), // <-- add this
}
IOS
Using the same instructions as https://facebook.github.io/react-native/docs/linking-libraries-ios.html
1- open in xcode open ios/yourProject.xcodeproj/
2- drag ./node_modules/react-native-sift/ios/reactNativeSift.xcodeproj to Libraries in you project view.
3- In the XCode project navigator, select your project, select the Build Phases tab drag Libraries > reactNativeSift.xcodeproj > Products > reactNativeSift.a into the Link Binary With Libraries section.
Usage
import Sift from 'react-native-sift';
Sift.initSdk(accountid, beaconkey); //init sdk
Sift.setUserId(id); // set user id