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).

The examples are verified against the historical 10.8.2 package, which declares React Native >=0.63.0. Use a host that still supports the Legacy Architecture: React Native 0.82 and later cannot enable it. See the React Native 0.82 release notes.

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: On React Native 0.76–0.81, explicitly disable the New Architecture using the settings above. React Native 0.82 and later require the New Architecture, so these flags cannot make a v10.x integration compatible.

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:

Install iOS dependencies#

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 (v10.x to v11.0.0+)

Support#