Heres how I add React native Storybook to an expo router project in 2 minutes
npm create storybookchoose recommended and then native
npx expo@latest customize metro.config.js| import { SafeAreaView, Platform } from 'react-native' | |
| import WebView from "react-native-webview"; | |
| const markdown = ` | |
| - hello from markdown | |
| - test | |
| --- |
Heres how I add React native Storybook to an expo router project in 2 minutes
npm create storybookchoose recommended and then native
npx expo@latest customize metro.config.js| import { readFileSync } from "node:fs" | |
| import * as babel from "@babel/core" | |
| import BabelPluginReactCompiler from "babel-plugin-react-compiler" | |
| import type { Plugin } from "esbuild" | |
| import QuickLRU from "quick-lru" | |
| export function ReactCompilerEsbuildPlugin({ | |
| filter, | |
| sourceMaps, | |
| runtimeModulePath, |
| import { StorybookConfig } from "@storybook/react-native-web-vite"; | |
| import { InlineConfig, mergeConfig } from "vite"; | |
| const main: StorybookConfig = { | |
| stories: ["../components/**/*.stories.@(js|jsx|ts|tsx)"], | |
| addons: ["@storybook/addon-docs", "@chromatic-com/storybook"], | |
| framework: { | |
| name: "@storybook/react-native-web-vite", |
| import { normalizeStories, loadMainConfig } from 'storybook/internal/common'; | |
| import { readFileSync } from 'node:fs'; | |
| import { sync as globSync } from 'glob'; | |
| import path from 'path'; | |
| import { CsfFile, loadCsf } from 'storybook/internal/csf-tools'; | |
| import { toId } from 'storybook/internal/csf'; | |
| import { | |
| type StoryIndex, | |
| type IndexedCSFFile, | |
| type NormalizedStoriesSpecifier, |