Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a1a34dc
feat: update documentation for entry-point swapping and deviceAddons
ndelangen Apr 14, 2026
f6bea62
refactor: streamline documentation and code for deviceAddons
ndelangen Apr 14, 2026
13d809f
docs: remove STORYBOOK_WS_HOST=auto usage from env var examples
Copilot Apr 14, 2026
d511146
docs: update Expo Router setup for Storybook integration
ndelangen Apr 14, 2026
f366b82
docs: revise Re.Pack setup guide for Storybook integration
ndelangen Apr 14, 2026
88bb51d
docs: update entry-point swapping instructions for Storybook integration
ndelangen Apr 14, 2026
fec1264
docs: refine Metro configuration documentation for Storybook integration
ndelangen Apr 14, 2026
10b6b0c
docs: enhance Storybook UI configuration documentation
ndelangen Apr 14, 2026
8963032
docs: clarify CLI configuration for Storybook integration
ndelangen Apr 14, 2026
a628be0
docs: update documentation to reflect changes from addons to deviceAd…
ndelangen Apr 14, 2026
1864a8b
docs: update WebSocket configuration examples to TypeScript
ndelangen Apr 14, 2026
c6cacec
docs: update backgrounds configuration instructions
ndelangen Apr 14, 2026
392217c
docs: update environment variable documentation for Storybook
ndelangen Apr 14, 2026
3af2a43
docs: standardize code snippet formatting to TypeScript
ndelangen Apr 14, 2026
4c62168
docs: standardize code snippet formatting to shell
ndelangen Apr 14, 2026
1dc01c4
copy edits
winkerVSbecks Apr 16, 2026
d3f361d
Update section title and clarify WebSocket testing setup
winkerVSbecks Apr 29, 2026
dc106be
docs: update migration guide for Storybook version 10.4
ndelangen May 4, 2026
00aefa1
docs: remove deprecated addons section from configuration documentation
ndelangen May 4, 2026
ec56174
docs: remove export statement for StorybookUIRoot in migration guide
ndelangen May 4, 2026
95029cd
docs: update withStorybook configuration in migration guide
ndelangen May 4, 2026
be5e516
docs: remove empty line in migration guide for Storybook version updates
ndelangen May 4, 2026
21779d9
Apply suggestion from @ndelangen
ndelangen May 4, 2026
de777bd
docs: add missing code block in repack documentation
ndelangen May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/commands/pr-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Generate a pull request description based on the changes in the current branch.
## Instructions

1. First, determine the base branch by checking for a PR or using `next` as default:
```bash
```sh
gh pr view --json baseRefName --jq '.baseRefName' 2>/dev/null || echo "next"
```

Expand All @@ -23,7 +23,7 @@ Generate a pull request description based on the changes in the current branch.
- Answer the template questions about examples and documentation

5. Check if a PR exists for this branch:
```bash
```sh
gh pr view --json number 2>/dev/null
```

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This file provides guidance to agents when working with code in this repository.

## Development Commands

```bash
```sh
# Initial Setup
pnpm install
pnpm build
Expand Down
4 changes: 3 additions & 1 deletion MANUAL_SETUP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Setup for v8 React Native Storybook

> **This guide is for v8.** For v10 manual setup instructions, see the [manual setup docs](https://storybookjs.github.io/react-native/docs/intro/getting-started/manual-setup).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is the case why don't we just replace the whole guide here with a link to the docs? potentially the title about it being v8 is just outdated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure how to address this feedback. Can you propose a solution, @dannyhw ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly probably just remove this document and replace links to it with a link to the guide in the docs


Before getting into the guide consider using a template for a simpler setup process.

**Prebuilt Templates:**
Expand Down Expand Up @@ -61,7 +63,7 @@ import type { StorybookConfig } from '@storybook/react-native';

const main: StorybookConfig = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: [],
deviceAddons: [],
};

export default main;
Expand Down
132 changes: 91 additions & 41 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Migration

- [Migration](#migration)
- [From version 9 to 10](#from-version-9-to-10)
- [Update Storybook dependencies to 10.x](#update-storybook-dependencies-to-10x)
- [From version 10.3 to 10.4](#from-version-103-to-104)
- [Update your metro config](#update-your-metro-config)
- [Simplify your App.tsx (or Expo Router routes)](#simplify-your-apptsx-or-expo-router-routes)
- [Regenerate your requires file](#regenerate-your-requires-file)
- [Move on-device addons to `deviceAddons`](#move-on-device-addons-to-deviceaddons)
- [Summary of breaking changes](#summary-of-breaking-changes)
- [Migrate to entry-point swapping](#migrate-to-entry-point-swapping)
- [From version 9 to 10](#from-version-9-to-10)
- [Update Storybook dependencies to 10.x](#update-storybook-dependencies-to-10x)
- [From version 8 to 9](#from-version-8-to-9)
- [Update Storybook dependencies to 9.x](#update-storybook-dependencies-to-9x)
- [Update your `.storybook` folder](#update-your-storybook-folder)
Expand Down Expand Up @@ -49,36 +52,7 @@
- [Test ids for tabs](#test-ids-for-tabs)
- [The server](#the-server)

## From version 9 to 10

Version 10 brings Storybook React Native in sync with Storybook core v10, introducing improved Metro configuration and a simplified API.

### Update Storybook dependencies to 10.x

You need to update all Storybook dependencies to version 10.x. This includes:

- `storybook` package (core)
- `@storybook/react` package
- `@storybook/react-native` package
- All `@storybook/addon-ondevice-*` packages

> Note: You can check the correct version by looking at the `peerDependencies`. Please refer to the [core Storybook migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-9x-to-1000) for more details on the breaking changes in Storybook core v10.

**Example package.json after upgrade:**

```json
{
"devDependencies": {
"@storybook/react-native": "^10.0.0",
"@storybook/react": "^10.0.0",
"@storybook/addon-ondevice-controls": "^10.0.0",
"@storybook/addon-ondevice-actions": "^10.0.0",
"@storybook/addon-ondevice-backgrounds": "^10.0.0",
"@storybook/addon-ondevice-notes": "^10.0.0",
"storybook": "^10.0.0"
}
}
```
## From version 10.3 to 10.4

### Update your metro config

Expand Down Expand Up @@ -206,16 +180,40 @@ The metro config (`enabled` flag) automatically handles bundle inclusion:

After updating dependencies and configuration, regenerate your `.rnstorybook/storybook.requires.ts` file:

```bash
```sh
yarn storybook-generate
```

Or if you have the generate call in your metro config (recommended), just restart metro:

```bash
```sh
yarn start --reset-cache
```

### Move on-device addons to `deviceAddons`
Comment thread
ndelangen marked this conversation as resolved.

On-device addons should now be listed in the `deviceAddons` property instead of `addons` in your `.rnstorybook/main.ts`. This prevents errors during server-side operations like `extract`, where Storybook Core would try to evaluate React Native code as Node.js presets.

**Before:**

```ts
const main: StorybookConfig = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: ['@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions'],
};
```

**After:**

```ts
const main: StorybookConfig = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
deviceAddons: ['@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions'],
};
```

For backwards compatibility, on-device addons in the `addons` array still work — they're detected by the "ondevice" substring in their name. If you're using the Storybook CLI, the `rn-ondevice-addons-to-device-addons` automigration handles this step automatically.

### Summary of breaking changes

1. **Metro config API changes:**
Expand All @@ -232,7 +230,59 @@ yarn start --reset-cache

4. **Simplified app entry:**
- Custom switcher components no longer needed for bundle optimization
- Metro config handles conditional inclusion automatically
- In-app integration (importing Storybook in App.tsx) continues to work and is fully supported

5. **`deviceAddons` property:**
- On-device addons should use the new `deviceAddons` property in `main.ts`
- Backwards compatible — `addons` still works for on-device addons

Version 10.4 introduces entry-point swapping through a bundler-agnostic `withStorybook` wrapper. This lets you switch between your app and Storybook at the bundler entry level, without importing Storybook inside `App.tsx`.

### Migrate to entry-point swapping

Instead of importing Storybook in your `App.tsx`, set `STORYBOOK_ENABLED=true` and use the new wrapper:

```js
// metro.config.js — new recommended import
const { withStorybook } = require('@storybook/react-native/withStorybook');

module.exports = withStorybook(config);
```

Then run with `STORYBOOK_ENABLED=true expo start`. No changes to `App.tsx` are required.

This is the recommended approach for new projects. Existing projects can migrate at their own pace — see [Migrating to Entry-Point Swapping](https://storybookjs.github.io/react-native/docs/intro/getting-started/migrating-to-entry-point-swapping) for a step-by-step guide.

Version 10 brings Storybook React Native in sync with Storybook core v10, introducing improved Metro configuration and a simplified API.

## From version 9 to 10

### Update Storybook dependencies to 10.x

You need to update all Storybook dependencies to version 10.x. This includes:

- `storybook` package (core)
- `@storybook/react` package
- `@storybook/react-native` package
- All `@storybook/addon-ondevice-*` packages

> Note: You can check the correct version by looking at the `peerDependencies`. Please refer to the [core Storybook migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-9x-to-1000) for more details on the breaking changes in Storybook core v10.

**Example package.json after upgrade:**

```json
{
"devDependencies": {
"@storybook/react-native": "^10.0.0",
"@storybook/react": "^10.0.0",
"@storybook/addon-ondevice-controls": "^10.0.0",
"@storybook/addon-ondevice-actions": "^10.0.0",
"@storybook/addon-ondevice-backgrounds": "^10.0.0",
"@storybook/addon-ondevice-notes": "^10.0.0",
"storybook": "^10.0.0"
}
}
```

## From version 8 to 9

Expand Down Expand Up @@ -458,7 +508,7 @@ We've removed the types from `@storybook/react-native` and now you should import

Heres an example story in version 7:

```typescript
```ts
import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';

Expand All @@ -482,13 +532,13 @@ export const Basic: Story = {

You can now also update main.js to main.ts and use the StorybookConfig type. This is one of the only types we export from @storybook/react-native in this version.

```typescript
```ts
// .storybook/main.ts
import type { StorybookConfig } from '@storybook/react-native';

const main: StorybookConfig = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: [
deviceAddons: [
'@storybook/addon-ondevice-notes',
'@storybook/addon-ondevice-controls',
'@storybook/addon-ondevice-backgrounds',
Expand All @@ -501,7 +551,7 @@ export default main;

To update preview.js to preview.tsx you can use the Preview type from @storybook/react

```typescript
```ts
import type { Preview } from '@storybook/react';

const preview: Preview = {
Expand Down Expand Up @@ -540,7 +590,7 @@ The setup is the same as `@storybook/addon-react-native-web` but with the reactN

#### First install necessary packages

```bash
```sh
yarn add -D @storybook/addon-react-native-web @storybook/addon-essentials storybook @storybook/react-webpack5 @storybook/react babel-plugin-react-native-web react-native-web @storybook/addon-react-native-server
```

Expand All @@ -557,7 +607,7 @@ With expo you should also add `@expo/metro-runtime`.

Add a `main.ts`

```typescript
```ts
// .storybook-web/main.ts
import type { StorybookConfig } from '@storybook/react-webpack5';

Expand Down
Loading
Loading