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

Provide React Native WS Server as Addon for React Storybook #5886

Closed
MrLoh opened this issue Mar 5, 2019 · 6 comments
Closed

Provide React Native WS Server as Addon for React Storybook #5886

MrLoh opened this issue Mar 5, 2019 · 6 comments

Comments

@MrLoh
Copy link

MrLoh commented Mar 5, 2019

Describe the solution you'd like
My company builds a shared component library between react-native and react-web projects. So I have a setup for storybook where stories are both rendered on the web with storybook/react and on native with storybook/react-native. That all works fine, but when developing, we have to manually keep the web and native views in sync. The storybook server for react-native already provides a nice way to control the native components, but it runs separate from the web stories.

Would it be possible to use the react web storybook to not only display the same components as the native app, with react-native-web, but also send the messages via the web socket to synchronize the displayed web stories with the native stories?

Are you able to assist bring the feature to reality?
I could definitely help with this, I am just not sure how the web socket server is set up, I briefly skimmed the code, but a brief introduction would be very helpful. I am not sure what the best way to set this up would be. Should this be an Addon, or a custom configuration of the web sever?

@MrLoh
Copy link
Author

MrLoh commented Mar 9, 2019

@Hypnosphi could you give me a pointer as to how I would go about building this. I understand that the react native server sets up a websocket server that forwards messages to all connected clients and that the manager emits the story selection events. But I don't understand how I'd go about adding a web socket server to the 'standard' react storybook server and how I'd inject a similar Provider into the 'standard' react storybook server. I have a repo here that shows my current setup: https://github.com/MrLoh/universal-react-storybook

@shilman
Copy link
Member

shilman commented Mar 9, 2019

@MrLoh I would recommend that you wait for the next version of @storybook/react-native before you embark on this. Specifically there is a major refactor that's been blocked for a couple months but apparently is "very close to ready" and it's sitting in this PR: #4942 Any work done on RN before this merge is likely to be superceded by the new code.

@shilman shilman closed this as completed Mar 22, 2019
@shilman shilman reopened this Mar 22, 2019
@shilman
Copy link
Member

shilman commented Mar 22, 2019

We’ve released a brand new @storybook/react-native with a bunch of core improvements. It’s available in the latest 5.1-alpha on next and has been verified by several RN users on their existing apps. It should fix a bunch of compatibility issues, especially if you’re using the web server feature. Please give it a try and comment here if it fixes your problem. Migration instructions available here: https://github.com/storybooks/storybook/blob/next/MIGRATION.md#react-native-server

@MrLoh

@stale
Copy link

stale bot commented Apr 12, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Apr 12, 2019
@stale
Copy link

stale bot commented May 12, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed May 12, 2019
@shilman
Copy link
Member

shilman commented May 13, 2019

We're on 5.1.0-beta now. Check it out!

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

2 participants