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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rokt/react-native-sdk

v4.11.4

Published

Rokt Mobile SDK to integrate ROKT Api into ReactNative application

Readme

@rokt/react-native-sdk

Overview

This repository contains React Native SDK Rokt.Widget as well as the Sample Application RoktSampleApp .

The React Native SDK enables you to integrate Rokt into your React Native mobile apps to drive more value from—and for—your customers. The SDK is built to be lightweight, secure, and simple to integrate and maintain, resulting in minimal lift for your engineering team. The RoktSampleApp includes bare-minimum UI to demonstrate the usage of React Native SDK for our partners using the Integration guide

Development Environment

Install ReactNative development environment by following the React Native environment setup guide.

For this project, a minimum Ruby version 2.7.6 is required. Check by running ruby -v on your terminal.

Integration Guide for Apps

To add this SDK in your Application, Go to the root of your project in your terminal and add run the below commands:

$ npm install @rokt/react-native-sdk --save

run $ npm install

You would also need to

Android Configuration

The Rokt SDK is available from Maven Central and will be resolved automatically via React Native autolinking. No manual repository or package configuration is required.

Ensure your app meets the minimum requirements:

android {
    defaultConfig {
        minSdkVersion 21
    }
}

iOS Configuration

Install the pods

go to ios folder and run command below to install the pod

pod install

Below Configurations are required only if you are using Mac M1 machines:

  1. Make sure cocoa pods are installed using gem not brew(sudo gem install cocoapods.
    If it is already installed using brew, use below commands to uninstall them

    brew uninstall cocoapods
    brew uninstall --ignore-dependencies ruby
  2. Install cocoapods with gem

    Sudo gem install cocoapods
  3. Replace the post_install in ios/podfile with below code

    post_install do |installer|
      react_native_post_install(installer)
    
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          # Disable arm64 builds for the simulator
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
      end
    end
  4. Reinstall the pods:

    cd ios
    pod deintegrate
    sudo arch -x86_64 gem install ffi
    arch -x86_64 pod install

Expo

This package cannot be used with the "Expo Go" app because it requires custom native code. Integration with Expo is supported in both bare workflow and managed workflow.

Bare Workflow

No additional configuration is required. React Native autolinking will automatically set up the SDK.

Managed Workflow

Since Expo Go does not support custom native code, you need to use a custom development client.

  1. Install the required packages:

    npm install @rokt/react-native-sdk expo-dev-client
  2. (Optional) Add the config plugin to your app.json or app.config.js:

    {
      "expo": {
        "plugins": ["@rokt/react-native-sdk"]
      }
    }

    Note: The config plugin is optional as React Native autolinking handles the native setup automatically.

  3. Generate the native projects and build:

    npx expo prebuild --clean
    npx expo run:ios   # or npx expo run:android

For production builds, you can use EAS Build which will handle the native compilation automatically.

Usage

Initialising the SDK

  • Rokt Module provides two methods:
  1. initialize(string ROKT_TAG_ID, string AppVersion)
  2. execute(string TemplateVersion, object UserAttributes, object placements, function onLoad)
  • The Initialize Method will fetch API results that Execute Method would need. so best not to put both calls next to each other.
Import
import { Rokt, RoktEmbeddedView } from "@rokt/react-native-sdk";
Initialize
Rokt.initialize("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "1.0");

To launch Overlay placement

Execute Overlay
attributes = {
  email: "[email protected]",
  firstname: "Jenny",
  lastname: "Smith",
  mobile: "(323) 867-5309",
  postcode: "90210",
  country: "US",
};
Rokt.execute("RoktExperience", attributes, null, () =>
  console.log("Placement Loaded"),
);

To launch Embedded placement

Create placeholder
  constructor(props){
    super(props);
    this.placeholder1 = React.createRef();
  }

in render()

<RoktEmbeddedView
  ref={this.placeholder1}
  placeholderName={"RoktEmbedded1"}
></RoktEmbeddedView>
Execute Embedded
placeholders = {
  RoktEmbedded1: findNodeHandle(this.placeholder1.current),
};

attributes = {
  email: "[email protected]",
  firstname: "Jenny",
  lastname: "Smith",
  mobile: "(323) 867-5309",
  postcode: "90210",
  country: "US",
};
Rokt.execute("RoktEmbeddedExperience", attributes, placeholders, () =>
  console.log("Placement Loaded"),
);

License

Copyright 2020 Rokt Pte Ltd

Licensed under the Rokt Software Development Kit (SDK) Terms of Use Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at https://rokt.com/sdk-license-2-0/