React Native

React Native components for StorySDK using WebView to display stories.

SDK token

To get SDK token go to app settings page and copy SDK token:

Installation

NPM

Yarn

Usage

StoryGroups

Component for displaying a list of story groups:

StoryModal

Component for displaying stories in a modal window:

Onboarding Implementation

For onboarding flows, use the StoryModal component with an Onboarding ID instead of a regular groupId:

Important: When an Onboarding ID is specified, the modal window will open automatically. Only use the StoryModal component for onboarding implementations.

Props

StoryGroups

  • token (required) - SDK token for accessing StorySDK

  • onGroupClick - Handler for group click events

  • groupImageWidth - Width of group image in pixels

  • groupImageHeight - Height of group image in pixels

  • groupTitleSize - Font size of group title in pixels

  • groupClassName - CSS class for styling individual group

  • groupsClassName - CSS class for styling groups container

  • activeGroupOutlineColor - Outline color for active group

  • groupsOutlineColor - Outline color for all groups

  • arrowsColor - Color of navigation arrows

  • backgroundColor - Background color of the component

  • onError - Error handler callback that receives error details

  • onEvent - Event handler callback that receives event type and associated data

StoryModal

  • token (required) - SDK token for accessing StorySDK

  • groupId - Group ID to display (or Onboarding ID for onboarding flows)

  • onClose - Handler for modal close event

  • storyWidth - Width of story in pixels

  • storyHeight - Height of story in pixels

  • isShowMockup - Whether to show device mockup around stories

  • isShowLabel - Whether to show labels

  • isStatusBarActive - Whether status bar is active

  • autoplay - Automatically play through stories

  • arrowsColor - Color of navigation arrows

  • backgroundColor - Background color of the component

  • forbidClose - Prevent modal from being closed (useful for critical onboarding flows)

  • onError - Error handler callback that receives error details

  • onEvent - Event handler callback that receives event type and associated data

SDK Events

StoryGroups and StoryModal components can handle the following events through the onEvent prop:

  • groupClose - Group of stories closed

  • groupOpen - Group of stories opened

  • storyClose - Story closed

  • storyOpen - Story opened

  • storyNext - Navigation to next story

  • storyPrev - Navigation to previous story

  • widgetAnswer - User response to a widget

  • widgetClick - Widget click

  • storyModalOpen - Modal window opened

  • storyModalClose - Modal window closed

  • groupClick - Story group clicked

onEvent Usage Example

Usage Example

Standard Story Implementation

Onboarding Implementation

Media Background Playback Permissions

For proper background media playback (audio/video), you need to configure additional permissions in your project:

iOS

Add the following to your iOS project's Info.plist file:

If you encounter the error ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback', you may need to add additional entitlements to your project:

  1. Create or edit the .entitlements file in your iOS project root

  2. Add the following entitlements:

  1. In Xcode, go to project settings > Signing & Capabilities and add the "Background Modes" capability, then enable the "Audio, AirPlay, and Picture in Picture" option

Android

Add the following to your Android project's AndroidManifest.xml:

These permissions are necessary to ensure continuous media playback even when the app is minimized or the screen is locked.

Last updated

Was this helpful?