Search code examples
mobileconfigurationexponativestorybook

Adding Storybook (native - to view stories on the mobile phone) to an existing, configured Expo project


I am new in Expo and React Native. How can I add a Storybook (native, only to view stories on the mobile phone) to an existing project with other configuration made already?

I tried to achieve this many ways, for example - following the official documentation: https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/ but at the end I always have the same when I try "npm run storybook", the error is: 'STORYBOOK_ENABLED' is not recognized as an internal or external command, operable program or batch file. this is from the package.json: "storybook": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start"

litterally every way leading me to this, even this official.

Thanks and greetings.


Solution

  • In my case on Windows changing scripts like this helped(only the "&&" place):

        "storybook": "sb-rn-get-stories STORYBOOK_ENABLED='true' && expo start",
        "storybook:ios": "sb-rn-get-stories STORYBOOK_ENABLED='true' && expo start --ios",
        "storybook:android": "sb-rn-get-stories STORYBOOK_ENABLED='true' && expo start --android"
    

    Also installing Android Studio(this for running the storybook by yarn storybook:android / npm run storybook: android to view on the ExpoGo).