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#
- 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:
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#
- 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
Upgrading to v11.0.0+#
Ready to upgrade to the latest version? Check our Migration Guide
Support#
- Contact support@getstoryteller.com for assistance