-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Framework: Add native storybook for components. #17829
Conversation
Nice one 😍 Based on my previous research and the screenshot included, this still requires a React Native project to be included in the repository so we could run it and embed the Storybook there. As far as I learned, there are 2 strategies:
@hypest @koke @pinarol - what would be the preferred approach? |
If I understand it correctly, both approaches could work, but I think having an example app might be less problematic for everyone, at least until we can make the developer onboarding smoother in the current apps |
I'm assuming that we want to have the native variants of the components running on the device so, we will have to have the full native dev pipeline in place, including the Aztec editor that powers the RichText component. I think an example app will end up replicating much if not all of the https://github.com/wordpress-mobile/gutenberg-mobile setup so, I'd probably wait until we merge that demo app in Gutenberg's repo first. Thoughts? |
We can start small with covering only UI components which don't have deep native dependencies like |
A simple react-native example app/project on |
This just runs the server for the mobile client to connect to. The code for the client can be anywhere, it just needs to connect to the machine running this server.
Yes, we should start with a simple build process that can start a React Native development client to run the native storybook for |
Is anyone already on that task? If yes, it would be ideal to collaborate with @dratwas that will be working these days on the "monorepo" plan (to merge the gutenberg-mobile repo to Gutenberg's) so the efforts are not replicated or diverging too much. |
Let's review it as is then and add native apps integration as soon as we can celebrate all native bits moved to this repository from https://github.com/wordpress-mobile/gutenberg-mobile. |
@gziolo This is good to go right? |
I've been trying to test this one, but I don't know how to make it work. Storybook seems to listen on port 7007, and react-native would try to connect to 8081. As far as I can see, changing the port that react-native tries to connect to can only be done by modifying the react-native sources. Considering that 7007 is the default for storybook-native, I feel like I'm missing something really obvious here 🤔 |
@koke 7007 is the port for the web interface that accompanies the app. The bundler is still on 8081. Here is a guide that might be of help: https://pusher.com/tutorials/storybook-react-native. |
Oh I see, that article was helpful. What's confusing is that
That article seems to assume you still run the bundler separately ( |
Yeah, we would need to have the mobile build process in here to integrate it all into a single command. Or, I could add a mini standalone RN app, but I feel like that could make it harder to eventually bring in the mobile repo. |
I've been trying to add a sample app just to test it, and the metro bundler doesn't like running any code outside it's root directory. I think the code in the PR would be OK to merge, but won't really be useful until we can figure out the right layout to launch. I did one last attempt by running it from within gutenberg-mobile and trying to just
I think |
Yeah, we'll need to polyfill it.
We might as well just wait until the mobile code is merged in then. I'll close this for now. |
Description
This PR adds Storybook for React Native and uses it to create a native version of the
@wordpress/components
storybook.This will be super useful for testing cross platform compatibility of components.
The new storybook can be started with
npm run design-system:dev:native
.How has this been tested?
It was verified that the web storybook still works as expected and that so does
npm run design-system:dev:native
.Screenshots
Checklist: