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

Stories not loaded for new generated react native application by expo cli.

Open igorgidea opened this issue 5 years ago • 3 comments

Describe the bug After adding storybook for new expo react-native blank project and run command "npm run storybook", browser opens up but no stories displayed at all, only "forever stories loading" on the left panel.

To Reproduce Steps to reproduce the behavior:

  1. create new react-native project with expo run: expo init myNewProject
  2. Setup React Native Storybook run command: npx -p @storybook/cli sb init --type react_native
  3. Replace content of App.js with these lines:
 import StorybookUI from './storybook';
export default StorybookUI;
  1. Run Storybook by command: npm run storybook

Expected behavior Should be displayed stories on left sidebar in browser.

Screenshots изображение

System: Windows 10 node 12.18.0 Storybook 5.3.19 expo 38.0.8 In browser Google Chrome 84.0.4147.8 or Firefox 78.0.2 there is "forever stories loading" on the left panel

igorgidea avatar Jul 24 '20 18:07 igorgidea

might be a duplicate of #55

dannyhw avatar Aug 11 '20 13:08 dannyhw

You should run storybook server and then after run the react native app then if you refresh the webpage for react native server the stories should load.

dannyhw avatar Aug 18 '20 22:08 dannyhw

I found there is an issue when using a real android device with expo. It can be resolved by specifying your port and host explicitly

When you start up the server you should see something with your IP here On your network: http://xxx.xxx.x.xx:7007/

Take this IP and set it explicitly as the host and then the storybookui should be able to reach the server

In code

const StorybookUIRoot = getStorybookUI({
  host: "192.111.1.11", // replace with your ip address
  port: "7007"
});

In package.json "storybook": "start-storybook -p 7007 -h 192.111.1.11"

Make sure to replace 192.111.1.11 with your local ip address

This should resolve the connection issues adb reverse tcp:7007 tcp:7007 also if it still doesn't work

dannyhw avatar Sep 06 '20 13:09 dannyhw