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#
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#
- 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'
- 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#
- Explore the Components and their configuration
- Learn about Theming to customize the appearance
- Explore Analytics for tracking user engagement
- Set up User Attributes for personalization
- Configure Ads integration
Support#
- Contact support@getstoryteller.com for assistance