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

React native Storybook 6.0

Open dannyhw opened this issue 5 years ago • 20 comments

Is your feature request related to a problem? Please describe.

Update react native storybook with the new api changes from storybook 6.0 and improvements.

Describe the solution you'd like

  • [x] csf support
  • [x] main.js/preview.js config style supported
    • [x] support for importing stories automatically
  • [x] args
  • [x] controls instead of knobs
  • [ ] Improved docs and tutorial
  • [ ] review the way the server works and maybe make it an addon
  • [ ] Improved typescript support (would be nice)
  • [ ] tests (at least unit tests)
  • [ ] developer experience improvements for contributors

6.0 bug fixes :

  • [x] remove deprecated components in favour of community components such as datetime picker (fixes react-native-web issues)

Additional context

Please use this issue for discussion on 6.0 such as suggestions or questions about its development.

dannyhw avatar Nov 12 '20 14:11 dannyhw

Please, add support for React v17.0 and React-Native v0.64

ivan-khr85 avatar Mar 19 '21 14:03 ivan-khr85

@ivan-khr85 hey, yeah I haven't had a chance to check this however I don't see any reason it wouldn't work. I will update the examples to 0.64 when I get a chance and check it out.

Did you already try it and had issues or something?

dannyhw avatar Mar 19 '21 16:03 dannyhw

@dannyhw One issue I am running into is thatReact-Native 0.64 uses the the latest of @testing-library/jest-native which breaks Storyshots (see thread. Getting React Native storybook to version 6.x should resolve the issue.

pang0018 avatar Mar 26 '21 20:03 pang0018

For more information please see the comments I made in this PR #135

dannyhw avatar May 11 '21 18:05 dannyhw

Tasks have been split into smaller parts that are tracked in the 6.0 project here #164 auto import stories #166 update version of repo to 6.0 #167 update storybook dependencies #168 update react native to 0.64.1 and react to 17 #169 update dependencies for ondevice addons #170 add react-native-web example

dannyhw avatar May 11 '21 20:05 dannyhw

CSF Support and ARGs are now complete with #175 being merged

dannyhw avatar May 31 '21 12:05 dannyhw

The first basic iteration of ondevice controls was added with #182 along with more of the declarative config features. The first alpha of 6.0 will be created once the issues in the first milestone are completed https://github.com/storybookjs/react-native/milestone/1

dannyhw avatar Jul 12 '21 21:07 dannyhw

Now that all the issues in the first milestone have been completed I have released the first alpha.

I've also created an initial guide on how you can get setup with a fresh project. Migration guide to come in the future.

Find the guide here: https://github.com/storybookjs/react-native/blob/next-6.0/v6README.md

dannyhw avatar Jul 18 '21 17:07 dannyhw

Can you make the list a checklist style

[ ] e.g. [x] so it looks nicer.

Also can you add the following to the list? [ ] migration guide

trajano avatar Sep 06 '21 23:09 trajano

Can you make the list a checklist style

[ ] e.g. [x] so it looks nicer.

Also can you add the following to the list? [ ] migration guide

Sure if that's useful I can update it like that 👍

dannyhw avatar Sep 06 '21 23:09 dannyhw

With version 6, how do you embed storybook inside an existing RN application? Where should the main.js, preview.js and storybook.require.js files go?

avertin avatar Nov 16 '21 21:11 avertin

With version 6, how do you embed storybook inside an existing RN application? Where should the main.js, preview.js and storybook.require.js files go?

@avertin That all works basically the same, the only difference is that the folder is now .storybook by default (added a .) . You still get a component returned from a getStorybookUI function call.

dannyhw avatar Nov 16 '21 23:11 dannyhw

when is the official 6.0 going to be released? would it be using webpack 5?

xiongemi avatar Nov 22 '21 17:11 xiongemi

when is the official 6.0 going to be released? would it be using webpack 5?

react native storybook doesn't use webpack so I don't know if that would matter much.

In regards to react-native 6.0 release date I would love to give a timeline but it's hard because it depends a lot on my free time. It will come out when it's ready, hopefully early next year. I'm likely going to be without a computer in December so that will delay things a bit.

dannyhw avatar Nov 22 '21 19:11 dannyhw

Any updates on this?

ramykl avatar Apr 23 '22 20:04 ramykl

@ramykl

Any updates on this?

Currently working on getting 6.4 storybook dependencies working. Once that's done probably the first stable version will not be far off. I'm leaning on the side of releasing asap and adding other missing features over time.

dannyhw avatar Apr 24 '22 12:04 dannyhw

Hi, I would like to know if is there any date setted to release the new stable version?

nicolascgarcia avatar May 25 '22 20:05 nicolascgarcia

@nicolascgarcia i would love to release a version but currently I'm at a bit of a blocker.

In order to support 6.4 and 6.5 versions of storybook a large rewrite of internals is necessary. A lot of that work is done but I've run into some problems which need help from other maintainers and so I've pairing on it a bit but its hard to organise.

Its hard to say because I don't have a lot of free time and external factors are involved. I plan to release the stable version as soon as it works with 6.4/6.5 and has been tested.

dannyhw avatar May 28 '22 09:05 dannyhw

@dannyhw I think what you have at the moment is good as an interim release so we can baseline and add 6.4/6.5 versions later. As the saying goes, "Don’t Let “Perfect” Be the Enemy of “Good"

trajano avatar May 28 '22 18:05 trajano

@trajano sorry for the late response here. I appreciate the encouragement and the sentiment here. There are a few things close to coming to fruition that i wanted to wait on. However I'm becoming more likely to ship as time goes on.

I had some positive talks recently with some core storybook maintainers that made it seem like progress is imminent which is something i need to follow up on again essentially.

I know this has been a really drawn out update so I appreciate the patience and I understand those questions about a release date. It's on my mind a lot so I promise its going to happen sooner or later.

dannyhw avatar Jun 29 '22 20:06 dannyhw

Update

  • new version will be 6.5.14 not 6.0, this is because new changes were needed in storybook to make react native work and that was introduced in 6.5.14 and therefore you must use a minimum of storybook version 6.5.14.
  • Compatibility with 6.5+ however means 6.4 and below won't work without patches.
  • I've now written a new tutorial for v6.5 and its under review
  • new sb init command with v6.5 support
  • server support has been added for v6.5
  • experimental support for auto arg types

New release is pending tutorial approval, documentation updates and a blog post for the release.

Thanks to everyone for your patience, a lot of weekends and late nights have gone into this release and whilst it taken longer than anyone wanted (me included), we're finally getting there.

dannyhw avatar Feb 22 '23 12:02 dannyhw

A note on v7:

As you may know v7 of storybook (web) is coming out soon, and whilst that might seem to be an issue for React Native I'm actually hopeful that we can get a V7 out in the coming months. The reason is that in the recent changes for 6.5 support a lot of changes were made that make React Native more compatible with ReactJS Storybook, even re-using a lot of the setup code (preview-web). I don't want to make premature promises, but I think we'll see a v7 within a reasonable time frame.

V7 will be a big release because it will likely solve other issues we've had such as polyfills polluting the global namespace (corejs promises I'm looking at you) and on demand story loading could be a possibility.

The difficult part will be getting react native to work with storystore v7 since the old store is deprecated. However I know a few people that can help me get that done so I'm hopeful.

dannyhw avatar Feb 22 '23 13:02 dannyhw

Thanks again for your massive efforts. v6 is a banger!

stevoland avatar Feb 23 '23 07:02 stevoland

@dannyhw If you need some help with any specific tests hit me up, be glad to look into it

alex1092 avatar Mar 03 '23 13:03 alex1092

@alex1092

v6 (6.5) is ready I'm just getting the release blog and tutorial reviewed whats left is basically updating the template projects, starter projects and documentation.

For example migration guide and also double checking all the github documentation. Seems like we'll get the bottom panel for addons in too

I still need to update these templates

~https://github.com/dannyhw/react-native-template-storybook~ ~https://github.com/dannyhw/react-native-storybook-starter~ ~https://github.com/dannyhw/expo-storybook-starter~ ~https://github.com/dannyhw/expo-template-storybook~

There is also all the documentation on this repo that needs double checking to make sure its up to date for 6.5

The migration guide is the next big documentation step I think

dannyhw avatar Mar 03 '23 13:03 dannyhw

Heres an interesting issue to pick up for you @alex1092

https://github.com/storybookjs/react-native/issues/377

Basically having an error boundary to show an error message instead of crashing.

dannyhw avatar Mar 04 '23 18:03 dannyhw

I've updated expo templates now and the migration guide. I also tried to update a few more pieces of documentation. Any proof reading very appreciated 🙏

dannyhw avatar Mar 04 '23 23:03 dannyhw

React native cli templates are updated, and release is planned for April 5th if all goes well.

dannyhw avatar Mar 11 '23 19:03 dannyhw

more details to come soon :)

Thanks everyone for your support, its been a journey.

dannyhw avatar Mar 29 '23 12:03 dannyhw

https://storybook.js.org/blog/storybook-for-react-native-6-5/

dannyhw avatar Mar 29 '23 15:03 dannyhw