storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
1.05k stars 152 forks source link

Storybook didn't work with react-native 0.72 #491

Closed info-sapphire closed 1 year ago

info-sapphire commented 1 year ago

To Reproduce Steps to reproduce the behavior:

  1. npx react-native@latest init AwesomeProject
  2. npx sb@latest init --type react_native
  3. remove App.tsx & create App.ts with export {default} from './.storybook';
  4. react-native run-ios
package.json ```json { "name": "AwesomeProject", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest", "storybook-generate": "sb-rn-get-stories", "storybook-watch": "sb-rn-watcher" }, "dependencies": { "react": "18.2.0", "react-native": "0.72.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native-async-storage/async-storage": "^1.18.2", "@react-native-community/datetimepicker": "^7.2.0", "@react-native-community/slider": "^4.4.2", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.6", "@storybook/addon-actions": "^6.5.16", "@storybook/addon-controls": "^6.5.16", "@storybook/addon-ondevice-actions": "^6.5.3", "@storybook/addon-ondevice-controls": "^6.5.3", "@storybook/react-native": "^6.5.3", "@tsconfig/react-native": "^3.0.0", "@types/metro-config": "^0.76.3", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "babel-loader": "^8.3.0", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.5", "prettier": "^2.4.1", "react-dom": "18.2.0", "react-native-safe-area-context": "^4.6.3", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "engines": { "node": ">=16" } } ```

Screenshots

dannyhw commented 1 year ago

Not a react native 72 problem you just need to update your metro config https://github.com/storybookjs/react-native#additional-steps-update-your-metro-config

info-sapphire commented 1 year ago

oh, thank you!