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 StorySDKonGroupClick- Handler for group click eventsgroupImageWidth- Width of group image in pixelsgroupImageHeight- Height of group image in pixelsgroupTitleSize- Font size of group title in pixelsgroupClassName- CSS class for styling individual groupgroupsClassName- CSS class for styling groups containeractiveGroupOutlineColor- Outline color for active groupgroupsOutlineColor- Outline color for all groupsarrowsColor- Color of navigation arrowsbackgroundColor- Background color of the componentonError- Error handler callback that receives error detailsonEvent- Event handler callback that receives event type and associated data
StoryModal
token(required) - SDK token for accessing StorySDKgroupId- Group ID to display (or Onboarding ID for onboarding flows)onClose- Handler for modal close eventstoryWidth- Width of story in pixelsstoryHeight- Height of story in pixelsisShowMockup- Whether to show device mockup around storiesisShowLabel- Whether to show labelsisStatusBarActive- Whether status bar is activeautoplay- Automatically play through storiesarrowsColor- Color of navigation arrowsbackgroundColor- Background color of the componentforbidClose- Prevent modal from being closed (useful for critical onboarding flows)onError- Error handler callback that receives error detailsonEvent- 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 closedgroupOpen- Group of stories openedstoryClose- Story closedstoryOpen- Story openedstoryNext- Navigation to next storystoryPrev- Navigation to previous storywidgetAnswer- User response to a widgetwidgetClick- Widget clickstoryModalOpen- Modal window openedstoryModalClose- Modal window closedgroupClick- 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:
Create or edit the
.entitlementsfile in your iOS project rootAdd the following entitlements:
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?