Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to integrate storybook into react-native package 'create-react-native-library'

Hi i want to run storybook in a react-native package, that i have created with create-react-native-library.

So, the steps i ve done, in order to havethe package up and running are:

  1. from the react-native documentation : https://reactnative.dev/docs/native-modules-setup
  2. Run npx create-react-native-library@latest react-native-awesome-module // create a simple package
  3. in the examplesfolder, run yarn start so it loads on the iPhone simulator.
  4. Because it is a package and not an application, i want to have storybook inside it, so to visualize the components.
  5. Install storybook like so: npx -p @storybook/cli sb init --type react

The yarn storybook command gives error like so: Error: Cannot find module ‘react-dom/package.json’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I attach a screenshot for reference:
enter image description here

So, is there a way to integrate the storybook into this package ? Do i miss anything ? thanks

>Solution :

According to the Storybook for React Native | Documentation,

You have to specify the --type as react_native not react.

npx -p @storybook/cli sb init --type react_native
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading