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 🙏

© 2026 – Pkg Stats / Ryan Hefner

customerio-reactnative

v8.0.1

Published

Official Customer.io SDK using React Native. Track customers and send messages to your iOS/Android apps.

Readme

npm version npm downloads min React Native version is 0.77 on Android and 0.79 on iOS min Android SDK version is 24 min iOS version is 15.1 Contributor Covenant

Customer.io React Native SDK

The official Customer.io SDK for React Native enables you to integrate mobile messaging features—like in-app messaging and push notifications—into your app. These features can be triggered by events sent through the SDK and configured using your Customer.io campaigns.

📖 Full documentation: customer.io/docs/sdk/react-native
🧪 Example apps: see the /example directory


Requirements

| | Minimum | Where it comes from | |---|---|---| | React Native | 0.77 on Android; on iOS 0.79 with CocoaPods, 0.88 in React Native's Swift Package Manager mode; New Architecture enabled | On iOS the SDK gets customerio-ios from its Swift package (since 8.0.0), through CocoaPods or React Native's Swift Package Manager mode, whose settings React Native reads from package.json starting with 0.88. On CocoaPods, React Native before 0.79 doesn't register the SDK's TurboModules (7.x neither). The SDK supports only the New Architecture (since 6.0.0). Its Android module applies the Compose compiler plugin with your app's Kotlin version, which needs Kotlin 2.0 or later; React Native 0.77 is the first release whose template uses Kotlin 2.0. | | iOS | 15.1 | React Native 0.76 and later require iOS 15.1. | | Android | API 24 (Android 7.0) | React Native 0.76 and later require API 24. | | Android build | compileSdkVersion 36, Android Gradle Plugin 8.9.1 | The native Android SDK depends on AndroidX Core 1.17, which requires both. |

The native Customer.io SDKs (5.0.0) require iOS 15 and API 24, which these React Native minimums already cover.

Apps created from the React Native 0.81 template or later meet the Android build requirement as generated. CI builds Android template apps with React Native 0.81 and 0.88; iOS template apps with React Native 0.79, 0.88 and 0.89 on CocoaPods (without use_frameworks!, and with static and dynamic frameworks) and with 0.88 and 0.89 in Swift Package Manager mode; and the example app and the scene E2E host in Swift Package Manager mode. On React Native 0.77 to 0.80, update the app's Android build:

  • Set compileSdkVersion = 36 and buildToolsVersion = "36.0.0" in android/build.gradle.
  • On 0.77 to 0.79, also raise the Android Gradle Plugin to 8.9.1 or later (classpath("com.android.tools.build:gradle:8.9.1")), which needs Gradle 8.11.1 or later in android/gradle/wrapper/gradle-wrapper.properties.

Expo apps use customerio-expo-plugin 5.0, the plugin release that works with customerio-reactnative 8.0. Coming from plugin 4.x, follow its migration guide.


Installation

npm install customerio-reactnative

iOS

From 8.0, the SDK gets the native Customer.io iOS SDK (customerio-ios) from its Swift package, whichever way your app builds its native libraries; no Customer.io pod is installed. Coming from 7.x, follow the migration guide.

CocoaPods

Apps that install their pods with CocoaPods keep doing so. pod install adds customerio-ios to the SDK's pod as a Swift package, with or without use_frameworks! (static or dynamic).

  1. Choose the push provider and optional modules with the subspecs, as in 7.x:

    # ios/Podfile, in the app target, before `use_native_modules!`
    pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
    pod 'customerio-reactnative/location', :path => '../node_modules/customerio-reactnative'

    | Subspec | Links | |---|---| | none, or nopush | MessagingPush, with no push provider | | apn | MessagingPushAPN | | fcm | MessagingPushFCM, and the FirebaseMessaging pod (8.7 up to, not including, 14), as in 7.x | | fcm-core | MessagingPushFCM, with your app's own FirebaseMessaging | | location, geofence, liveactivities | that module (geofence turns on location as well) |

    APN and FCM can't be combined. Or set the same choices as globals at the top of ios/Podfile, before any target; the subspecs add to them:

    $customerio_push_provider = 'apn' # or 'fcm', 'fcm-core'
    $customerio_location_enabled = true
    $customerio_geofence_enabled = true
    $customerio_live_activities_enabled = true

    On CocoaPods, iOS ignores android/gradle.properties, as in 7.x: its location and geofence keys turn those modules on for Android only.

  2. Install, and again after changing one:

    cd ios && pod install
  3. Rich push: add the rich push pod to your Notification Service Extension target. It links customerio-ios's push product from its Swift package and compiles none of the React Native bridge:

    target 'NotificationService' do
      pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative' # or /fcm
    end
  4. Live Activities: add https://github.com/customerio/customerio-ios.git to the project in Xcode (File > Add Package Dependencies, Up to Next Major Version from the major version of the cioNativeiOSSdkVersion in the SDK's package.json, for example 5.0.0), and add LiveActivities_Attributes and LiveActivities_Templates to the widget target. The SDK pins an exact version and Swift Package Manager resolves your range to it, so SDK updates don't need this changed.

  5. FCM apps on the fcm subspec get Firebase as pods, as in 7.x, shared with the app's other Firebase pods. Firebase 12 is the last on CocoaPods; apps that want Firebase 13 or later use fcm-core and add Firebase themselves. Firebase's pods need use_frameworks! and, with Xcode 27, the deployment-target helper.

On React Native before 0.84, React Native builds its fmt dependency from source, and Xcode 27.2 rejects it with a consteval error, with or without this SDK. Build fmt as C++17 in your Podfile's post_install, after react_native_post_install:

installer.pods_project.targets.each do |target|
  next unless target.name == 'fmt'
  target.build_configurations.each { |config| config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17' }
end

If bundle exec pod install fails with cannot load such file -- kconv on Ruby 3.4 or later, with or without this SDK, add gem 'nkf' to your Gemfile and run bundle install: older React Native templates (such as 0.79's) don't list it. If Xcode rejects other pods' deployment targets, see the deployment-target guide.

React Native's Swift Package Manager mode (React Native 0.88+)

Every native library in the app has to support this mode.

  1. Apps still on CocoaPods convert once, then commit the changes to the Xcode project. On React Native 0.88, keep an ios/Podfile (React Native's CLI finds the iOS project through it) with only a comment in it, since the one this command leaves isn't valid Ruby. Delete any CocoaPods ios/YourApp.xcworkspace.

    npx react-native spm add --deintegrate

    Apps already in Swift Package Manager mode run npx react-native spm update after installing.

  2. Choose the push provider and turn on the optional modules you use in android/gradle.properties. The Android build reads the location and geofence keys too; the push provider and live activities are iOS-only. By default there's no push provider (the SDK links MessagingPush on its own) and every module is off; geofence turns on location as well.

    # apn, or fcm (MessagingPushFCM, with FirebaseMessaging from your app)
    customerio_push_provider=apn
    customerio_location_enabled=true
    customerio_geofence_enabled=true
    customerio_live_activities_enabled=true

    After changing one, run npx react-native spm update before building. Without it, that build stops with "its Swift package changed during this build ... Build again", and the next build uses the new modules.

  3. For rich push and Live Activities, add https://github.com/customerio/customerio-ios.git to the project in Xcode (File > Add Package Dependencies, Up to Next Major Version from the major version of the cioNativeiOSSdkVersion in the SDK's package.json, for example 5.0.0). Add MessagingPushAPN or MessagingPushFCM to the Notification Service Extension target, and LiveActivities_Attributes and LiveActivities_Templates to the widget target.

  4. FCM apps add FirebaseMessaging from https://github.com/firebase/firebase-ios-sdk to the app target. React Native Firebase doesn't build in this mode; apps using it install with CocoaPods.

Both

Only the push provider you choose is linked, as with 7.x's subspecs; APN apps get no Firebase.


SDK Initialization

Here’s a simplified example showing how to initialize the SDK to enable most mobile features:

import {
  CustomerIO,
  CioConfig,
  CioLogLevel,
  CioRegion,
} from 'customerio-reactnative';

useEffect(() => {
  const config: CioConfig = {
    cdpApiKey: 'your-cdp-api-key', // Required
    migrationSiteId: 'your-site-id', // Optional, for migrating from older SDKs
    region: CioRegion.US, // Or CioRegion.EU
    logLevel: CioLogLevel.debug,
    trackApplicationLifecycleEvents: true,
    inApp: {
      siteId: 'your-site-id', // Optional with a pk_ key
    },
    push: {
      android: {
        pushClickBehavior: 'ActivityPreventRestart', // Optional
      },
    },
  };

  CustomerIO.initialize(config);
}, []);

🔑 For help finding your credentials, check out the Quick Start Guide.


📲 Push Notifications

This SDK supports rich push notifications using Firebase (for Android) and either Firebase or APNs (for iOS). Follow our push setup guide to configure your project for push. On iOS, use the packages from iOS installation in place of the guide's CocoaPods steps.

On iOS, a React Native 0.88+ UIScene host using the acknowledged handler must declare that ownership before React Native starts. This API is not used on Android or by AppDelegate-only hosts. Call this first in scene(_:willConnectTo:options:) so cold destinations wait for the JavaScript handler instead of entering the legacy Linking path:

NativeCustomerIO.configureAcknowledgedSceneDeepLinkRouting()

Register the app's Customer.io deep-link handler before calling CustomerIO.initialize. Return true after routing a URL. Return false to let the native SDK try the host AppDelegate, then pass a host-owned custom scheme to React Native Linking or open other URLs through the system. If your handler might decline an app-owned custom scheme, keep a Linking URL listener registered for that fallback. A thrown error, rejected promise, missing handler, or handler timeout follows the same native fallback. Cold URLs wait up to ten seconds for registration and are replayed once the handler is ready. After delivery, the handler has ten seconds to settle. If it takes longer, native fallback runs; a handler that later routes the URL can cause a second navigation because its acknowledgement cannot cancel the fallback.

const subscription = CustomerIO.setDeepLinkHandler(async (url) => {
  if (!canRouteInApp(url)) {
    return false;
  }

  await routeInApp(url);
  return true;
});

CustomerIO.initialize(config);

Remove the returned subscription when the routing owner is torn down. If no replacement handler registers, later destinations wait for the readiness timeout and then use the native fallback.

The existing Linking path remains available for backward compatibility. Keep NativeCustomerIO.configureSceneDeepLinkRouting() in your SceneDelegate, then signal readiness after registering the listener:

const subscription = Linking.addEventListener('url', ({ url }) => {
  // Route the URL in your app.
});
CustomerIO.setDeepLinkRoutingReady();

Cold destinations wait up to ten seconds for this readiness signal. If it does not arrive, the SDK tries the host AppDelegate, passes a host-owned custom scheme to React Native Linking, or opens other URLs through the system.

This older path cannot acknowledge whether JavaScript handled the URL, so the SDK cannot safely fall back after it publishes a Linking event. Prefer setDeepLinkHandler for new UIScene integrations. Older React Native versions and AppDelegate-only hosts keep their existing deep-link integration.

Expo apps keep the Linking path. With config-plugin auto-initialization, register the app's Linking listener, then call CustomerIO.setDeepLinkRoutingReady() after the router is ready. The Expo plugin configures its native scene lifecycle automatically, so Expo app code does not call a native configuration method. Apps using JavaScript initialization register the router before CustomerIO.initialize; initialization marks Linking ready automatically.

This integration applies after the host has adopted React Native's UIScene lifecycle; the plugin does not replace React Native's root application lifecycle.

This release's compatibility scope is one simultaneous window scene. Multiple simultaneous React Native window scenes are not supported. React Native's URL notification is process-wide, so SDK-published destinations may reach every connected React Native instance rather than one selected window.

iOS FCM

With FCM chosen, the SDK links MessagingPushFCM and Customer.io's Firebase adapter, which finds FirebaseMessaging at runtime. Without FirebaseMessaging in the app, MessagingPushFCM.initialize stops the app at launch. On CocoaPods, the fcm subspec adds the FirebaseMessaging pod, as in 7.x, and fcm-core adds none (for Firebase 13 or later, which isn't on CocoaPods); in Swift Package Manager mode, add FirebaseMessaging from https://github.com/firebase/firebase-ios-sdk to the app target.

Apps with React Native Firebase install with CocoaPods and use the fcm-core subspec, as in 7.x: React Native Firebase supplies FirebaseMessaging. Its default (Firebase from Swift packages) needs React Native Firebase 26.3.3 or later and use_frameworks! :linkage => :dynamic; with $RNFirebaseDisableSPM = true (Firebase from pods), use static frameworks. Tested with React Native Firebase 26.4.2 (both) and 27.2.0 (its default); the migration guide has the AppDelegate details.


🔴 Live Activities

Enable the activity types you use under the liveNotifications key of your SDK config. On iOS, also add NSSupportsLiveActivities to your app's Info.plist, turn the module on (the liveactivities subspec or $customerio_live_activities_enabled = true in the Podfile on CocoaPods, customerio_live_activities_enabled=true in android/gradle.properties in Swift Package Manager mode), and add a Widget Extension that renders the SDK's built-in templates (see iOS installation). Without the Info.plist key, iOS refuses to start any activity:

<key>NSSupportsLiveActivities</key>
<true/>

One manual step is required on iOS. Forward every opened URL to the SDK from the host's active lifecycle, or taps on a Live Activity are not attributed. NativeLiveActivities comes from the SDK's Swift module, so import it. This only compiles once the module is on: on CocoaPods, the liveactivities subspec or $customerio_live_activities_enabled = true in the Podfile; in Swift Package Manager mode, customerio_live_activities_enabled=true in android/gradle.properties.

For an AppDelegate host:

import customerio_reactnative
import React

extension AppDelegate {
  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    // Reports an `opened` metric and returns the deep link to route to. A non-Customer.io URL comes
    // back unchanged; `nil` means the activity carried no deep link, so there is nothing to open.
    guard let routableUrl = NativeLiveActivities.handleWidgetUrl(url) else { return true }
    return RCTLinkingManager.application(app, open: routableUrl, options: options)
  }
}

A React Native AppDelegate conforms to UIApplicationDelegate directly rather than subclassing, so this method is not an override, and the URL is passed on to RCTLinkingManager instead of super. See the sample app's AppDelegate.swift for this in context.

For a UIScene host, handle both lifecycle paths. At scene connection, pass the connection options through the wrapper so a cold Live Activity tap is attributed and its destination enters the acknowledged Customer.io router. Ordinary app links remain in React Native launch options for Linking:

import customerio_reactnative

reactNativeFactory?.startReactNative(
  withModuleName: "YourApp",
  in: window,
  launchOptions: NativeLiveActivities.reactNativeLaunchOptions(from: connectionOptions)
)

Then replace the ordinary React Native URL-forwarding body in the existing SceneDelegate for warm opens. This reports Live Activity taps, sends Customer.io destinations through the configured Customer.io router, and forwards ordinary app links to React Native Linking:

import customerio_reactnative

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
  for context in URLContexts {
    NativeLiveActivities.handleAndRouteWidgetUrl(context.url)
  }
}

Do not also pass those URLs to RCTLinkingManager. The helper already routes them through the Customer.io bridge, and forwarding them again can deliver the same URL twice.

Android needs no equivalent native step.

For Expo Router, unwrap the URL once in the app's top-level app/+native-intent.tsx file:

import { CustomerIO } from 'customerio-reactnative';

export async function redirectSystemPath({ path }: { path: string }) {
  return CustomerIO.liveActivities.handleWidgetUrl(path);
}

This reports the opened event, returns the customer's destination, preserves ordinary URLs, and returns null for a Customer.io tracking URL without a destination. Do not also call the helper from a Linking listener because processing the same tracking URL twice reports two opened events. Expo apps without Expo Router can apply the helper once in their central Linking initial-URL and subscription pipeline.


Identify Users, Track Events, and More

Customer.io helps you personalize your mobile experience:


Contributing

We welcome contributions! To get started:

  1. Review our example app to help with local development.
  2. Follow our Code of Conduct.

License

MIT