getStorybookUI method, which provides options for customizing the on-device interface, WebSocket connections, and story persistence.
Basic Usage
index.tsx
Configuration Options
Options
Whether to show the on-device Storybook UI.When
false, only renders the story component without navigation controls.Set to
false if you want to render stories in your own custom navigation.Set as
false to disable the wrapper around the story view.Enable WebSockets for the Storybook server to remotely control Storybook.This allows you to control the on-device Storybook from a browser or external tools.See WebSocket Configuration for details.
Optional query string to append to the WebSocket connection URL.
The host for the WebSocket server.
- Android emulator: Defaults to
10.0.2.2(host machine from emulator) - iOS simulator & physical devices: Defaults to
localhost
If you configured WebSockets in Metro config, the host is automatically injected via
globalThis.STORYBOOK_WEBSOCKET.host.The port for the WebSocket server.
If you configured WebSockets in Metro config, the port is automatically injected via
globalThis.STORYBOOK_WEBSOCKET.port.Whether to use secure WebSocket connections (
wss:// instead of ws://).The initial story to display when Storybook loads.Can be a story ID string or an object with
kind and name.The
kind is the default export name or storiesOf("name") name. The name is the named export or .add("name") name.Whether to persist story selection between app restarts.When
true, requires the storage option to be configured.Custom theme object to override the default Storybook theme.The theme automatically switches between light and dark mode based on the device’s color scheme.See @storybook/react-native-theming for available theme properties.
Storage implementation for persisting story selection.Required if
shouldPersistSelection is true.Custom UI component to use instead of the default Storybook UI.This allows you to create a completely custom interface for navigating stories.The
children prop contains the rendered story component.Examples
Complete Configuration
index.tsx
Headless Mode (No UI)
Custom Theme
Deep Linking
Storybook automatically handles deep links to specific stories:Deep linking works automatically. No additional configuration is needed beyond setting up your app’s URL scheme.
Storage Key
Storybook stores the last opened story ID using the key:storage implementation (typically AsyncStorage).