Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stories doesn't show up in the browser #1398

Closed
Hunsu opened this issue Jul 1, 2017 · 27 comments
Closed

Stories doesn't show up in the browser #1398

Hunsu opened this issue Jul 1, 2017 · 27 comments

Comments

@Hunsu
Copy link

Hunsu commented Jul 1, 2017

I followed the instructions in read me to add storybook to my application (not CRNA application). When I run my application I get blank page and the basic stories doesn't show up in the browser.

@danielduan
Copy link
Member

Can you share the code you have in /stories?

@Hunsu
Copy link
Author

Hunsu commented Jul 1, 2017

It the code generated by getStoryBook. I didn't change anything but I can share if you want. I wanted to try storybook with my app based on https://github.com/junedomingo/movieapp

@ritz078
Copy link
Contributor

ritz078 commented Jul 4, 2017

Same is happening for me.

@matt-oakes
Copy link
Contributor

Is there anything in the console of the browser window?

@ghost
Copy link

ghost commented Jul 6, 2017

I had this issue, but turns out I forgot to add configure(loadStories, module) at end of .storybook/config.js

@ritz078
Copy link
Contributor

ritz078 commented Jul 7, 2017

@matt-oakes There is no error in the console.

@pckhoi
Copy link

pckhoi commented Jul 10, 2017

This is also happening for me (CRNA app). I just started playing with storybook + react native yesterday. Below are my dependencies and devDependencies:

  "devDependencies": {
    "@storybook/react-native": "3.1.8",
    "jest-expo": "~18.0.0",
    "react-native-scripts": "0.0.40",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "dependencies": {
    "expo": "^18.0.3",
    "react": "16.0.0-alpha.12",
    "react-dom": "16.0.0-alpha.12",
    "react-native": "^0.45.1"
  }

@codecitrus it seems latest build of storybook only has index.android.js and index.ios.js and no config.js in storybook folder. And configure is called alright, I've made no changes to those files.

@matt-oakes there are some warnings about Stateless function components cannot be given refs. but that's it.

@pckhoi
Copy link

pckhoi commented Jul 11, 2017

Just found out the solution - I have to replace localhost with my pc's ip address here:

const StorybookUI = getStorybookUI({port: 7007, host: 'localhost'});

Working perfectly now!

@slorber
Copy link
Contributor

slorber commented Jul 11, 2017

This is related to this existing issue:

#1222

I hadn't time to work on it but it should not be too hard if the dev setup is now ok

@josefernand
Copy link

Same problem with a clean CRNA app and following the instructions to add storybook. No stories are shown in the left panel even replacing localhost with the IP address.
I see these warnings in the browser console:

warning.js?6327:35 Warning: Failed prop type: The prop `selectedKind` is marked as required in `Stories`, but its value is `undefined`.
    in Stories (created by LeftPanel)
    in LeftPanel (created by Container(LeftPanel))
    in Container(LeftPanel) (created by Layout)
    in div (created by Layout)
    in div (created by Layout)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by Layout)
    in div (created by Layout)
    in Layout (created by Container(Layout))
    in Container(Layout)
    in div
Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of `Container(LeftPanel)`.
    in LeftPanel (created by Container(LeftPanel))
    in Container(LeftPanel) (created by Layout)
    in div (created by Layout)
    in div (created by Layout)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by Layout)
    in div (created by Layout)
    in Layout (created by Container(Layout))
    in Container(Layout)
    in div
Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of `Container(ShortcutsHelp)`.
    in ShortcutsHelp (created by Container(ShortcutsHelp))
    in Container(ShortcutsHelp)
    in div

@shilman
Copy link
Member

shilman commented Aug 1, 2017

@josefernand I just got it working in a fresh CRNA app, so let's figure out what's going wrong. Your symptoms seem to be identical to: #1567

Duplicating my response here:

It's a little wonky. What's supposed to happen is that:

1. You run storybook and open it in http://localhost:7007
2. You shouldn't see any stories to start out
3. You run it on your device and it connects to the storybook server on localhost:7007
4. The stories show up in the browser, and on your device

Let me know if that works for you?

Also I've submitted a PR to address #1222 referenced above, should simplify things a bit once it's merged/released: #1568

@josefernand
Copy link

@shilman It's working now thanks a lot!

@shilman
Copy link
Member

shilman commented Aug 1, 2017

@josefernand was it just a matter of following those instructions? or did you have to do something else?

@josefernand
Copy link

@shilman my app was not loading properly on the device, so the stories were not loaded either. Following your instructions, I finally realized that.

@danielduan
Copy link
Member

Please reopen if there's still an issue.

@tibbus
Copy link

tibbus commented Oct 23, 2017

@shilman I have tried that on a clean install of react-native init , there are no stories after I start the simulator.

Do I need to do any other changes ? everything is fresh I didn't changed nothing.

@ghost
Copy link

ghost commented Jan 15, 2018

I got the same problem as @tibbus

@tibbus
Copy link

tibbus commented Jan 17, 2018

As far as I remember my issue was that I started the simulator before the storybook server. You need first to start the storybook and then run react-native run....

@jialiwei
Copy link

jialiwei commented Mar 2, 2018

@tibbus my issue is exactly the same with you.And with the right sequence ,it works...

@swaroopa94
Copy link

@Hunsu Did you solve the issue I got the same issue he stories were not displaying in the browser.
I have two terminals running in parallel also
and babel-core is of version 6 only
I created the app using react native init
Can you suggest me how to solve this.

@pibo
Copy link

pibo commented Mar 26, 2018

Same problem.

@Hunsu
Copy link
Author

Hunsu commented Mar 26, 2018

@swaroopa94 Yes the issue was solved for me a while ago. I don't really use it right now so I can't say.

@swaroopa94
Copy link

@Hunsu you did not remember what you did?

@nivort
Copy link

nivort commented May 1, 2018

The official guid only tell us to run 'npm run storybook', but it's very important for react native developers to know when to run this command, and where the components would shows.
For me:
1. Stop the application, make sure port 8801 is not in use.
2. run 'npm run storybook'
3. run 'react-native run-ios'

Then the components would shows on the ios simulator. The broswer only show me a list of the control.
Does anyone find a way to show the controls on browser?

@pgonzalez-santiago
Copy link

pgonzalez-santiago commented Oct 6, 2018

Hello all, I am facing a similar issue. When I run npm run storybook I always see an empty screen in http://localhost:7007 The only way for me to see the stories is modify my index.js of the application to register the StorybookUIHMRRoot component instead of my App component:

Like this: AppRegistry.registerComponent('Lisa', () => StorybookUIHMRRoot)

What should I do to enable the stories without changing the index of my application?

UPDATE
Due to I use reactotron I just added this line into my app

console.tron.storybookSwitcher(StorybookUIHMRRoot)(App)

@marexv
Copy link

marexv commented Nov 10, 2019

Does anyone find a way to show the controls on browser?

@nivort I think it can't be done, take a look at #7723

@jasongaare
Copy link

Sorry I know this is an old issue - but I'm scratching my head following the React Native tutorial at learnstorybook.com because all the screenshots seem to imply that you should see the elements in the browser too: https://www.learnstorybook.com/intro-to-storybook/react-native/en/simple-component/

Is there some magic I can't figure out? All I see is the PreviewHelp.js file from react-native-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests