npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sift-react-native

v0.1.13

Published

A React Native wrapper for Sift iOS and Android SDKs

Downloads

17,507

Readme

sift-react-native

React Native wrapper for Sift iOS and Android SDKs

Installation

  • Install library from npm:
    yarn add sift-react-native
    or
    npm install sift-react-native

Link native code

Android React Native 0.60.0 or above

No additional setup is required

iOS React Native 0.60.0 or above

Mostly autolinking will do the job. If manual linking is required, please follow the below steps:

  1. Insert the following line in Podfile where new pods are added: pod 'sift-react-native', :path => '../node_modules/sift-react-native'
  2. Navigate to the ios directory of the project via terminal and run pod install

Android React Native 0.59 or below

Automatically

react-native link

Manually

  1. Append the following lines to android/settings.gradle:

    include ':sift-react-native'

    project(':sift-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/sift-react-native/android')

  2. Insert the following lines inside the dependencies block in android/app/build.gradle:

    implementation project(':sift-react-native')

  3. Open up android/app/src/main/java/[...]/MainApplication.java

  • Add import com.siftreactnative.SiftReactNativePackage; to the imports at the top of the file
  • Add new SiftReactNativePackage() to the list returned by the getPackages() method. Add a comma to the previous item if there's already something there.

Insert the following lines inside the dependencies block in android/app/build.gradle:

   implementation 'com.android.support:support-v4:27.0.2'

iOS React Native 0.59 or below

Support will be available soon

Usage

First, import the module:

import SiftReactNative from "sift-react-native";

Then, invoke the following method to initialise the SDK:

Configure the account details

SiftReactNative.setSiftConfig(accountId, beaconKey, disallowCollectingLocationData, serverUrlFormat);

Where:

  • accountId (string, the Account ID that needs to be obtained from Sift console under API Keys tab) required
  • beaconKey (string, the Beacon Key that needs to be obtained from Sift console under API Keys tab) required
  • disallowCollectingLocationData (boolean, permission to allow collection of location data from device)

Make sure to add location permissions to your application if you want Sift to collect location data. Sift will not request permissions that are not granted by the user from your application.

  • serverUrlFormat (string, the format of URL where the data needs to be uploaded) -- Sample URL format for iOS: https://api3.siftscience.com/v3/accounts/%@/mobile_events -- Sample URL format for Android: https://api3.siftscience.com/v3/accounts/%s/mobile_events

NB: This feature is available only in iOS platform

Set the User ID

As soon as your application is aware of the user id, set it on the Sift instance using the code below. All subsequent events will include the user id.

SiftReactNative.setUserId(userId);

If the user logs out of your application, you should unset the user id:

SiftReactNative.unsetUserId();

Upload event

To upload collected events to sift.

SiftReactNative.upload();

Set page name

NB: This feature is available only in Android platform

To set the page name

SiftReactNative.setPageName("HomePage");

Example

To see sift-react-native in action you can check out the source in the example folder.

To initialize example project

yarn bootstrap

When the bootstrap is done, you will be able to start the example app by executing one of the following commands:

iOS app

yarn example ios

Android app

yarn example android

License

MIT