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).
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.
importStorytellerSdkfrom'@getstoryteller/react-native-storyteller-sdk';constinitializeStoryteller=()=>{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}
{"slug": "getting-started-react-native-legacy", "page_title": "React Native (Legacy)", "page_url": "getting-started/react-native-legacy/", "canonical_url": "/react-native/getting-started/react-native-legacy/", "markdown": "# React Native with Legacy Architecture (v10.x and below)\n\nThis 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).\n\n## Ensure New Architecture is Disabled\n\n### Android\n\nCheck your `android/gradle.properties` file contains:\n\n```groovy\nnewArchEnabled=false\n```\n\n### iOS\n\nCheck your `ios/Podfile` file contains:\n\n```ruby\nENV['RCT_NEW_ARCH_ENABLED'] = '0'\n```\n\n> **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.\n\n## Installation\n\nInstall the SDK using npm or yarn:\n\n```bash\nnpm install @getstoryteller/react-native-storyteller-sdk@^10.8.2 # or your desired version\n```\n\nor\n\n```bash\nyarn add @getstoryteller/react-native-storyteller-sdk@^10.8.2 # or your desired version\n```\n\n### Android Configuration\n\nAdd the following to your `android/build.gradle` file:\n\n```groovy\nallprojects {\n repositories {\n // Required for Storyteller SDK native dependencies\n maven { url 'https://storyteller.mycloudrepo.io/public/repositories/storyteller-sdk' }\n }\n}\n```\n\n### iOS Configuration\n\n1. Add the following sources to the top of your `ios/Podfile`:\n\n```ruby\nsource 'https://cdn.cocoapods.org/'\nsource 'https://github.com/getstoryteller/storyteller-sdk-ios-podspec.git'\n```\n\n1. Install the native dependencies:\n\n#### For React Native >= 0.60\n\n```bash\ncd ios && pod install\n```\n\n## Basic Implementation\n\n### Initialize the SDK (Callback-based API)\n\nExample provided below:\n\n```typescript\nimport StorytellerSdk from '@getstoryteller/react-native-storyteller-sdk';\n\n const initializeStoryteller = () => {\n StorytellerSdk.initialize(\n {\n apiKey: 'YOUR_API_KEY',\n externalId: 'USER_ID',\n },\n (callback: { result: boolean, message: string }) => {\n console.log(`Result: ${callback.result}, Message: ${callback.message}`);\n\n if (callback.result) {\n console.log('Storyteller initialized successfully');\n } else {\n console.error('Failed to initialize:', callback.message);\n }\n }\n );\n\n // ...rest of your code\n}\n```\n\n## Next Steps\n\n- Explore the [Components](../Storyteller.md) and their configuration\n- Learn about [Theming](../Themes.md) to customize the appearance\n- Explore [Analytics](../Analytics.md) for tracking user engagement\n- Set up [User Attributes](../UserCustomization.md) for personalization\n- Configure [Ads](../Ads.md) integration\n\n## Upgrading to v11.0.0+\n\nReady to upgrade to the latest version? Check our [Migration Guide (v10.x to v11.0.0+)](migration-v10-to-v11.md)\n\n## Support\n\n- Contact <[email protected]> for assistance\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}