react-native icon indicating copy to clipboard operation
react-native copied to clipboard

react-native storybook is not really working after simple installation

Open osh91 opened this issue 4 years ago • 7 comments

Just for your information, I am not using yarn. Only npm.

After simple installation by calling npx sb init I have got this error image

I have read old issues but it didn't give me clarify how to solve them.

when I am running it keeps saying image but I have run my android emulator and my private phone but it doesn't show anything on storybook!

here is my dependencies from package.json "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "@storybook/addon-actions": "^5.3.21", "@storybook/addon-knobs": "^5.3.21", "@storybook/addon-links": "^5.3.21", "@storybook/addon-ondevice-actions": "^5.3.23", "@storybook/addon-ondevice-knobs": "^5.3.25", "@storybook/react-native": "^5.3.25", "@storybook/react-native-server": "^5.3.23", "babel-jest": "^26.6.3", "babel-loader": "^8.2.4", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.67.0", "react-dom": "^17.0.2", "react-test-renderer": "17.0.2" I am guessing that storybook doesn't work due to the latest major update React and react-native?

osh91 avatar Apr 10 '22 09:04 osh91

also running into issues here, the project I'm working on is displaying a blank screen (react native) if I try to update my yarn lock, even if I use resolution to force a @types/react version

caiorrsdeg avatar Apr 11 '22 14:04 caiorrsdeg

Hey thanks for taking the time to create this issue.

First that red text is not an error, it's just advice about how to use storybook.

Also this issue with the sidebar not loading is well documented and can be resolved by seeing the suggestions in the issue that already exists #55

Closing as duplicate, please let me know if you would like me to reopen.

dannyhw avatar Apr 12 '22 00:04 dannyhw

Hi, so I took a read #55 and I can't find the proper solution. Where is the answer? I am really confused. The getting started page is not helping me. I'm having panic

First that red text is not an error, it's just advice about how to use the storybook.

Please update the colour of the information text. It should not be red this is why you get so much feedback.

osh91 avatar May 03 '22 11:05 osh91

@OshedheMunasinghe hey sorry if its not clear I just didn't want to have the discussion split in too many places.

Basically the solution is set your local ip address manually and a port of your choosing for both the server and the ondeviceui config. Keeping the same ip and port for both.

For example:

In package.json

"storybook": "start-storybook -p 7007 -h 172.1.1.1",

and getStorybookUI (where ever you are calling it)

const StorybookUIRoot = getStorybookUI({
    host:'172.1.1.1',
    port:'7007',
    asyncStorage: null
});

Make sure the host ip is the correct local ip address for your machine.

dannyhw avatar May 03 '22 16:05 dannyhw

So I called ipconfig and took the ip adress from wiress LAN adapter wifi IPv4 adress and pasted on package.json and storybook index.js in getStorybookUI

but it still loading I have called first storybook server then I called emulator npx react-native run-android

... I dont understand... im lost.

osh91 avatar May 03 '22 17:05 osh91

@OshedheMunasinghe You should run the emulator first, the server needs to get the stories from the device.

I would also consider that you don't really need to run the server in most cases, it's just an optional thing.

dannyhw avatar May 03 '22 18:05 dannyhw

Happy to continue the discussion here but If you want feel free to reach out to me on twitter or discord.

We have discord server with a react native channel that I'm active in and it's easier to have quick discussions there. https://discord.gg/sMFvFsG

dannyhw avatar May 03 '22 18:05 dannyhw