๐งฉ Integration
Requirementsโ
To use Sherlo, ensure the following packages are installed:
react-native
- version 0.64.0 or higher@storybook/react-native
- version 7.6.11 or higher
Dependenciesโ
To install Sherlo, run:
- npm
- Yarn
- pnpm
- Bun
- Deno
npm install -D @sherlo/react-native-storybook
yarn add -D @sherlo/react-native-storybook
pnpm add -D @sherlo/react-native-storybook
bun add -D @sherlo/react-native-storybook
deno add -D @sherlo/react-native-storybook
If your project has iOS native code, run:
cd ios
- to navigate to the folderpod install
- to install the iOS dependencies
Storybook Componentโ
To enable Sherlo to navigate through stories, update the Storybook component
Storybook component is typically exported from .rnstorybook
or .storybook
at project root
import AsyncStorage from "@react-native-async-storage/async-storage";
import { getStorybook } from "@sherlo/react-native-storybook";
import { view } from "./storybook.requires";
const Storybook = view.getStorybookUI({
const Storybook = getStorybook(view, {
storage: {
getItem: AsyncStorage.getItem,
setItem: AsyncStorage.setItem,
},
});
export default Storybook;
Storybook Accessโ
To enable Sherlo to access Storybook, choose one of these options:
- Standalone Storybook
- Integrated Storybook
Provide a build that opens straight into Storybook
No app, no menu โ Storybook only
Update your Root component to enable Storybook access:
- when testing with Sherlo
- via Dev Menu or openStorybook()
Root component could be App.jsx
or app/_layout.jsx
, depending on your project structure
import { addStorybookToDevMenu, isStorybookMode } from "@sherlo/react-native-storybook";
import Storybook from "./.rnstorybook"; // updated Storybook component
import App from "./App"; // main App component
addStorybookToDevMenu();
export default function Root() {
if (isStorybookMode) {
return <Storybook />;
}
return <App />;
}
Access Storybook via Dev Menu or openStorybook()
It's not supported by Expo Go, as it depends on native modules
Dev Menu - Available only in development builds
- Shake your device or press:
- iOS: Cmd โ+Ctrl+Z
- Android: Cmd โ+M
- Click
Toggle Storybook
to show or hide Storybook

openStorybook() - Available in all builds
Add a button to open Storybook using the openStorybook()
function:
import { openStorybook } from "@sherlo/react-native-storybook";
import { Button } from "react-native";
function OpenStorybookButton() {
return <Button title="Open Storybook" onPress={openStorybook} />
}
This is useful for internal distribution, as it can be accessed without running a development build