Skip to content

React Native with Legacy Architecture (v10.x and below)#

This guide covers the installation and setup of Storyteller SDK v10.x and below, which requires React Native's Old Architecture (New Architecture must be disabled).

Ensure New Architecture is Disabled#

Android#

Check your android/gradle.properties file contains:

newArchEnabled=false

iOS#

Check your ios/Podfile file contains:

ENV['RCT_NEW_ARCH_ENABLED'] = '0'

Important: If you're using React Native 0.76 or higher, the New Architecture is enabled by default and you must explicitly disable it using the settings above.

Installation#

Install the SDK using npm or yarn:

npm install @getstoryteller/react-native-storyteller-sdk@^10.8.2 # or your desired version

or

yarn add @getstoryteller/react-native-storyteller-sdk@^10.8.2 # or your desired version

Android Configuration#

Add the following to your android/build.gradle file:

allprojects {
    repositories {
        // Required for Storyteller SDK native dependencies
        maven { url 'https://storyteller.mycloudrepo.io/public/repositories/storyteller-sdk' }
    }
}

iOS Configuration#

  1. Add the following sources to the top of your ios/Podfile:
source 'https://cdn.cocoapods.org/'
source 'https://github.com/getstoryteller/storyteller-sdk-ios-podspec.git'
  1. Install the native dependencies:

For React Native >= 0.60#

cd ios && pod install

Basic Implementation#

Initialize the SDK (Callback-based API)#

Example provided below:

import StorytellerSdk from '@getstoryteller/react-native-storyteller-sdk';

  const initializeStoryteller = () => {
    StorytellerSdk.initialize(
      {
        apiKey: 'YOUR_API_KEY',
        externalId: 'USER_ID',
      },
      (callback: { result: boolean, message: string }) => {
        console.log(`Result: ${callback.result}, Message: ${callback.message}`);

        if (callback.result) {
          console.log('Storyteller initialized successfully');
        } else {
          console.error('Failed to initialize:', callback.message);
        }
      }
    );

  // ...rest of your code
}

Next Steps#

Upgrading to v11.0.0+#

Ready to upgrade to the latest version? Check our Migration Guide

Support#