Skip to content

React Native with New Architecture (v11.0.0+)#

This guide covers the installation and setup of Storyteller SDK v11.0.0 and higher, which requires React Native's New Architecture.

Verify New Architecture is Enabled#

Android#

Check your android/gradle.properties file contains:

newArchEnabled=true

iOS#

Check your ios/Podfile file contains:

ENV['RCT_NEW_ARCH_ENABLED'] = '1'

Note: React Native 0.76 and above have the New Architecture enabled by default.

Installation#

Install the SDK using npm or yarn:

npm install @getstoryteller/react-native-storyteller-sdk

or

yarn add @getstoryteller/react-native-storyteller-sdk

Android Configuration#

The Storyteller Android SDK artifacts are published to Maven Central. Most React Native projects include mavenCentral() by default. If your project has a custom repository setup, make sure mavenCentral() is available in your android/build.gradle file:

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

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-lottie-ios-podspec.git'
source 'https://github.com/getstoryteller/storyteller-sdk-ios-podspec.git'
  1. Install the native dependencies:
cd ios && pod install

Basic Implementation#

Initialize the SDK (Promise-based API)#

Example provided below:

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

  const initializeStoryteller = async () => {
    try {
      await StorytellerSdk.initialize('YOUR_API_KEY', 'USER_ID');
      console.log('Storyteller initialized successfully');
    } catch (error) {
      console.error('Storyteller initialization error:', error);
    }
  };

  // ...rest of your code

Next Steps#

Support#