setup-react-native-storybook
Set up Storybook for React Native in Expo, React Native CLI, or Re.Pack projects. Use when adding Storybook to a project, configuring metro.config.js with withStorybook, creating .rnstorybook configuration files, setting up Storybook routes in Expo Router, configuring
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Set up Storybook for React Native in Expo, React Native CLI, or Re.Pack projects. Use when adding Storybook to a project, configuring metro.config.js with withStorybook, creating .rnstorybook configuration files, setting up Storybook routes in Expo Router, configuring getStorybookUI, or adding the StorybookPlugin to a Re.Pack rspack/webpack config. Covers Expo, Expo Router, plain React Native CLI, and Re.Pack setups.
How to use
Zidentyfikuj typ swojego projektu: sprawdź czy używasz Expo z Expo Router (plik
_layout.tsxw kataloguapp/), Expo bez routera, React Native CLI, czy Re.Pack (obecnośćrspack.configlubwebpack.config).Sprawdź menedżer pakietów projektu — poszukaj pliku
yarn.lock,pnpm-lock.yamllubbun.lockbi używaj odpowiedniej komendy (yarn,pnpmlubbun) zamiastnpmwe wszystkich instrukcjach.Uruchom inicjalizację Storybook poleceniem
<pmu003e create storybookz odpowiednimi flagami dla Twojego typu projektu (tylko npm wymaga--przed flagami, nie używajnpxanibunx).Dla projektów Expo zainstaluj zależności komendą
npx expo install(lubbunx expo installitp.), aby Expo mogło rozwiązać kompatybilne wersje pakietów.Skonfiguruj
metro.config.jszwithStorybooki utwórz pliki.rnstorybookzgodnie z instrukcjami dla Twojego typu projektu (Expo Router wymaga ustawienia tras, Re.Pack wymaga dodania StorybookPlugin do konfiguracji).Uruchom Storybook komendą
<pmu003e storybook(z użyciem menedżera pakietów z kroku 2) i sprawdź, czy komponenty ładują się prawidłowo.