Installation
A basic installation takes around 15 minutes, but will take a little longer if you want to customize the way the Cello Referral Component is launched. Compatibility- The Cello React Native wrapper supports React Native 0.59 and above.
- Cello for iOS supports iOS 15+.
- Cello for Android supports API 21+.
Install Cello
Android Setup
Automatic Linking (RN v0.60+)
Library is automatically linked after installation.React Native v0.59 (Automatic Linking)
React Native v0.59 (Manual Linking)
android/settings.gradle
android/app/build.gradle
Android Initialization
Update yourMainApplication.java:
android/app/src/main/AndroidManifest.xml:
iOS Setup
Automatic Linking (RN v0.60+)
Library links automatically afterpod install.
Manual Linking (RN v0.59)
- Open
.xcworkspaceor.xcodeproj. - Insert the
CelloSDK.xcframeworkinto your project (enable “Copy items if needed”). - In target settings, set it to Embed & Sign under Frameworks, Libraries, and Embedded Content.
iOS Initialization
InAppDelegate.m, add:
didFinishLaunchingWithOptions you’ll need to initialize Cello. Add the snippet below using the productId and token
Choose an Environment
In your Cello SDK setup, you have the flexibility to select the environment in which your application will run. This feature is especially useful for different stages of development, such as testing in a development or staging environment before going live in production. The available environments are:prod(Production) (default)sandbox(Sandbox)
Using Cello with Expo
If you are using Expo, you can use the built-in plugin. After installing the @getcello/cello-react-native package, add the config plugin to theplugins array of your app.json or app.config.js:
prebuild) the native app. If no extra properties are added, defaults will be used.
env(string): Set to your desired environment, such asprod,sandbox. Optional. Defaults toprod.
Customize the Cello Referral Component
The Cello React Native allows for various levels of customization to better fit into your app’s design and flow. One of the main components you might want to customize is the Referral componentChoose Your Launcher
The library provides two ways to launch the Referral component: Default launcher If you choose to go with the default launcher, you can call theshowFab() method from the Cello library to present a Floating Action Button (FAB) within your app. This FAB is pre-styled but may not perfectly match your app’s look and feel.
Cello.openWidget().
React Native API
Cello.initialize(InitializeOptions): Promise<Configuration>
Initializes the Cello referral component.
InitializeOptions
| Property | Type | Required | Description |
|---|---|---|---|
| productId | string | yes | Your product ID from Cello Portal |
| token | string | yes | User authentication token |
| productUserDetails | ProductUserDetails | no | User details object (see below) |
| language | string | no | Initial language of the widget |
| themeMode | string | no | Initial theme mode: "light" or "dark" |
ProductUserDetails
Optional object with user information:| Property | Type | Description |
|---|---|---|
| firstName | string | User’s first name |
| lastName | string | User’s last name |
| fullName | string | User’s full name |
| string | User’s email address |
Cello.showFab(): void
Shows the default Cello button that launches the Referral Component
Cello.hideFab(): void
Hides the default Cello button that launches the Referral Component
Cello.openWidget(): void
Opens the referral component.
Cello.hideWidget(): void
Hides the referral component.
Cello.getActiveUcc(): Promise<{ ucc: string; inviteLink: string; } | null>
A method to get an active ucc and invite link for the currently logged in user.
Cello.changeLanguage(langCode: string): void
A method to change the language of the Referral component at runtime without re-initialising it.
Cello.setThemeMode(themeMode: string): void
A method to change the theme mode of the Referral component at runtime without re-initialising it.
themeMode(string): The theme mode to set. Valid values are"light"or"dark".
Cello.shutdown(): void
Shuts down connection to Cello and unmounts the component
Error Handling
Promise rejection codes
| Code | Platform(s) | Trigger | Typical causes |
|---|---|---|---|
InitializationError | iOS & Android | Cello.initialize completes with native failure | Invalid/empty product ID or token, network issues, bad environment |
InitializationException | Android | Unexpected exception inside Cello.initialize | Activity finishing, SDK not linked correctly, runtime crash |
ActivityError | Android | Cello.initialize without an active Activity | Initialization triggered too early (e.g. before React root ready) |
TokenUpdateError | iOS | Cello.updateToken failure | Token expired/invalid, network errors |
LanguageChangeError | iOS | Cello.changeLanguage failure | Unsupported language code, network errors |
ThemeModeChangeError | iOS | Cello.setThemeMode failure | Invalid theme mode value, network errors |
UnavailableError | iOS | Feature requires iOS 14+ | Device running < iOS 14 when calling token, language, or theme updates |
NO_ACTIVE_UCC | iOS | Cello.getActiveUcc with no active referral | User has not generated an invite yet |
UCC_ERROR | Android | Cello.getActiveUcc threw | SDK not initialized, network or serialization errors |
CAMPAIGN_CONFIG_ERROR | Android | Cello.getCampaignConfig threw | SDK not initialized, configuration not ready |
LINKING_ERROR | JavaScript | Module not linked | Pod install missing, app not rebuilt, using Expo Go |
Tip: The React Native bridge rejects promises with the objects above. Inspecterror.code,error.message, and (on iOS)error.nativeStackIOSfor extra context.
Common error scenarios
1. Initialization promise rejected
Symptoms:InitializationError or InitializationException in the catch block.
Fix: Validate credentials, confirm network connectivity, and ensure you selected the right environment (prod vs sandbox). Compare native logs with the iOS and Android error references for detailed native codes.
2. Module not linked (LINKING_ERROR)
Symptoms: Error thrown immediately when importing @getcello/cello-react-native.
Fix: Run pod install inside ios, rebuild the app, and ensure you are not running inside Expo Go. For older RN versions (0.59), double-check manual linking steps.
3. UI calls before initialization finishes
CallingCello.showFab(), Cello.openWidget(), or similar before the SDK is ready triggers native console warnings such as "Error: showFab() called before initialization.". Track initialization state in JavaScript and gate UI interactions until Cello.initialize resolves.
4. Platform feature limitations
Cello.changeLanguage and Cello.setThemeMode require iOS 14+. On older devices the bridge rejects with UnavailableError. Guard these calls with a platform/version check.
Error handling best practices
1. Wrap initialization in try/catch:
Cello.showFab() or Cello.openWidget() after a successful initialization. Keep a dedicated isCelloReady state flag in your components.
3. Retry on transient errors: For recoverable failures (network timeouts, InitializationError), schedule a retry with exponential or linear backoff. Limit retries to avoid looping endlessly.
4. Log error details: Capture error.code, error.message, and relevant native stack traces in your logging/monitoring solution to help support diagnose issues quickly.