This React Native sample app demonstrates how to integrate and use the Customer.io React Native SDK. It includes example implementations for push notifications using Apple Push Notification Service (APNs) or Firebase Cloud Messaging (FCM), depending on how the app is initialized.
All CustomerIO.* calls are located in src/App.tsx for easy reference. Other parts of the app are unrelated to SDK functionality.
Key files involved in the native iOS setup:
ios/Podfile: Customer.io and push provider podsios/SampleApp/AppDelegate.swift: Push initialization and Universal Linksios/NotificationServiceExtension/NotificationService.swift: Rich push implementation
Note: You'll see FCM- and APN-specific code snippets. This is intentional to demonstrate the setup differences.
-
React Native Environment
- Follow the React Native environment setup guide.
- Minimum iOS version: 16.4+
-
Customer.io Account & Push Configuration
- If you don't have Customer.io account, sign up for a free account.
- Follow the Quick Start Guide to setup your Customer.io workspace for push notifications and obtain API Key
Run the following one-time setup:
# Clone the Repo
git clone https://github.com/customerio/customerio-reactnative
cd customerio-reactnative/example
./scripts/sample-apps-init.sh # Initializes Android + iOS with APN setup
# OR
./scripts/sample-apps-init.sh fcm # Initializes Android + iOS with FCM setupSet your credentials in the following files:
ios/NotificationServiceExtension/Env.swiftsrc/env.ts
Update provisioning profiles and bundle IDs to match your own app setup.
Customer.io dev team: Search for
RN SampleApp Push Setupin 1Password to access signing credentials.
cd customerio-reactnative/example # Navigate to the example folder
npm run ios # Builds and runs on iOS
npm run android # Builds and runs on AndroidTo switch the app configurations between APN and FCM:
-
Close Xcode.
-
Navigate to the iOS directory:
cd customerio-reactnative/example/ios -
Run one of the following:
- For APNs:
bundle exec pod install - For FCM:
PUSH_PROVIDER=fcm bundle exec pod install
- For APNs:
- Common causes include provisioning profile issues or simulator mismatches.
- Best approach: open
ios/SampleApp.xcworkspacein Xcode to inspect the error.
If it’s a simulator issue:
cd customerio-reactnative/example # Navigate to the example folder
npm run ios -- --simulator "iPhone 16 Pro (18.0)"Replace with your simulator’s actual name and iOS version.
To list available simulators:
xcrun simctl list devicesFor Customer.io mobile dev team or other developers interested in the sample app itself.
If there is a need to update any of the app names, it should be updated in:
ios/SampleApp/BuildSettings/(apn|fcm)/Common.xcconfig:INFOPLIST_KEY_CFBundleDisplayNamecustomerio-reactnative/index.js:AppRegistry.registerComponent(...)customerio-reactnative/example/android/app/src/main/java/io/customer/rn_sample/fcm/MainActivity.kt:getMainComponentNamecustomerio-reactnative/example/src/env.ts.sample: Keys of theAppEnvValuesobject
The iOS project supports both APN and FCM targets using .xcconfig files and symlinks.
Key Concepts:
SampleApp.xcodeprojis untracked and dynamically configured.- Build settings are managed via dedicated
.xcconfigfiles for each variant. - Running
bundle exec pod installautomates this setup:- It invokes methods from the script
scripts/ios_project_setup_utils.rbwhich:- Creates the
ios/SampleApp.xcodeprojif it doesn't exist - Creates symlinks to the appropriate config files
- The config files sets app specific configs as well as preprocessor flags like
USE_APNorUSE_FCM
- Creates the
- It invokes methods from the script
ios/SampleApp.xcodeprojis preconfigured to use the symlink of the configs created in the previous steps- The native code uses the preprocessor flags for conditional imports and logic in native code
This process is triggered through the following command from the customerio-reactnative/example/ios folder.
PUSH_PROVIDER=(apn|fcm) bundle exec pod installThis file is untracked to avoid irrelevant changes from CocoaPods.
To track meaningful edits:
-
Ensure your changes apply to both APN and FCM builds.
-
Run:
cd customerio-reactnative/example # Ensure you are in the example folder ./scripts/track_ios_project_changes.sh
This command will:
- Deintegrate pods
- Copies
SampleApp.xcodeprojtoSampleApp.xcodeproj.trackedto track the changes
To continue development:
cd customerio-reactnative/example/ios # Ensure you are in the ios folder
PUSH_PROVIDER=(fcm|apn) bundle exec pod installPull requests and feedback are welcome. Please ensure your updates are consistent across both FCM and APN setups.