storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
996 stars 141 forks source link

Issue running react-native-server on the example app #520

Closed mljlynch closed 8 months ago

mljlynch commented 8 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce

infinite spinner:

image

Expected behavior It works

dannyhw commented 8 months ago

If you want the server to work you need to go into the example app and enable websockets, not sure if they are on by default in the example app.

mljlynch commented 8 months ago

enableWebsockets is set to true by default in getStorybookUI - however yarn web fails with:

Unable to resolve "telejson" from "../../node_modules/@storybook/channel-websocket/dist/esm/index.js"

I can get the server started by running:

npx react-native-storybook-server

But this leads to the infinite spinner above.

dannyhw commented 8 months ago

@mljlynch make sure you are on the right branch, you need to be on the next branch. Otherwise you'll be running old code.

mljlynch commented 8 months ago

This is on a fresh clone so I am on the next branch by default.

dannyhw commented 8 months ago

after you open the mobile app and the server ui can you try refreshing the mobile ui for example by hitting r, usually that gets it working

dannyhw commented 8 months ago

and yeah if I remember correctly yarn web will fail currently just because metro web isn't working correctly with some esm stuff. Might need to add the webpack version back for a bit.

However you should be able to try stuff with android/ios

mljlynch commented 8 months ago

yes confirmed working for iOS.

mljlynch commented 8 months ago

woah ok that works. let's goooooo!

mljlynch commented 8 months ago

Ok It works,BUT it won't switch through the components it just shows the default body:

image
dannyhw commented 8 months ago

@mljlynch the server ui doesn't have any preview its just for controlling the mobile device UI. There is another project for react native web storybook http://github.com/storybookjs/addon-react-native-web that runs on reactjs storybook. If you're looking to see components on the web you should go there.