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

React native Storybook 6.5 #131

Closed
10 of 11 tasks
dannyhw opened this issue Nov 12, 2020 · 34 comments
Closed
10 of 11 tasks

React native Storybook 6.5 #131

dannyhw opened this issue Nov 12, 2020 · 34 comments

Comments

@dannyhw
Copy link
Member

dannyhw commented Nov 12, 2020

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

  • csf support
  • main.js/preview.js config style supported
    • support for importing stories automatically
  • args
  • controls
  • Improved docs and tutorial
  • server for v6
  • Improved typescript support (would be nice)
  • tests (at least unit tests)
  • developer experience improvements for contributors

6.0 bug fixes :

  • 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.

Now released, checkout the blog: https://storybook.js.org/blog/storybook-for-react-native-6-5/

@ivan-khr85
Copy link

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

@dannyhw
Copy link
Member Author

dannyhw commented Mar 19, 2021

@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?

@pang0018
Copy link

@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.

@dannyhw
Copy link
Member Author

dannyhw commented May 11, 2021

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

@dannyhw dannyhw pinned this issue May 11, 2021
@dannyhw
Copy link
Member Author

dannyhw commented May 11, 2021

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
Copy link
Member Author

dannyhw commented May 31, 2021

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

@dannyhw
Copy link
Member Author

dannyhw commented Jul 12, 2021

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
Copy link
Member Author

dannyhw commented Jul 18, 2021

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

@trajano
Copy link

trajano commented Sep 6, 2021

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

@dannyhw
Copy link
Member Author

dannyhw commented Sep 6, 2021

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 👍

@avertin
Copy link

avertin commented Nov 16, 2021

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?

@dannyhw
Copy link
Member Author

dannyhw commented Nov 16, 2021

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.

@xiongemi
Copy link

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

@dannyhw
Copy link
Member Author

dannyhw commented Nov 22, 2021

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.

leotm added a commit to leotm/react-native-template-new-architecture that referenced this issue Feb 15, 2022
leotm added a commit to leotm/react-native-template-new-architecture that referenced this issue Feb 16, 2022
leotm added a commit to leotm/react-native-template-new-architecture that referenced this issue Feb 16, 2022
From DevDep tree (similar to 5bc69b5)

├─┬ @storybook/[email protected]
│ └─┬ @storybook/[email protected]
│   └─┬ [email protected]
│     ├── [email protected]
│     └─┬ [email protected]
│       └── [email protected]
├─┬ @storybook/[email protected]
│ └─┬ @storybook/[email protected]
│   └─┬ [email protected]
│     ├── [email protected]
│     └─┬ [email protected]
│       └── [email protected]
└─┬ @storybook/[email protected]
  └─┬ @storybook/[email protected]
    └─┬ @storybook/[email protected]
      └─┬ [email protected]
        ├── [email protected]
        └─┬ [email protected]
          └── [email protected]

Resolve
- GHSA-wvhm-4hhf-97x9
- GHSA-h4hr-7fg3-h35w
- GHSA-gj77-59wh-66hg
- GHSA-hqhp-5p83-hx96

May be worth considering/including again in
- storybookjs/react-native#131
- https://github.com/storybookjs/react-native/projects/2#card-68690945
@ramykl
Copy link

ramykl commented Apr 23, 2022

Any updates on this?

@dannyhw
Copy link
Member Author

dannyhw commented Apr 24, 2022

@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.

@nicolascgarcia
Copy link

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

@dannyhw
Copy link
Member Author

dannyhw commented May 28, 2022

@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.

@trajano
Copy link

trajano commented May 28, 2022

@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"

@dannyhw
Copy link
Member Author

dannyhw commented Jun 29, 2022

@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
Copy link
Member Author

dannyhw commented Feb 22, 2023

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
Copy link
Member Author

dannyhw commented Feb 22, 2023

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.

@stevoland
Copy link
Contributor

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

@alex1092
Copy link

alex1092 commented Mar 3, 2023

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

@dannyhw
Copy link
Member Author

dannyhw commented Mar 3, 2023

@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
Copy link
Member Author

dannyhw commented Mar 4, 2023

Heres an interesting issue to pick up for you @alex1092

#377

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

@dannyhw
Copy link
Member Author

dannyhw commented Mar 4, 2023

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
Copy link
Member Author

dannyhw commented Mar 11, 2023

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

@dannyhw
Copy link
Member Author

dannyhw commented Mar 29, 2023

more details to come soon :)

Thanks everyone for your support, its been a journey.

@dannyhw dannyhw closed this as completed Mar 29, 2023
@dannyhw dannyhw changed the title React native Storybook 6.0 React native Storybook 6.5 Mar 29, 2023
@dannyhw
Copy link
Member Author

dannyhw commented Mar 29, 2023

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

@douglasjunior
Copy link

douglasjunior commented Mar 30, 2023

I'm trying the storybook 6 right now, but I'm getting these errors: storybookjs/storybook#15067

TypeError: (tag.text || "").trim is not a function

Maybe related to type inheritance like this:

export type CustomTextProps = TextProps & {
    /// ...
};

My project was created by npx react-native init StoryBook6Example --template react-native-template-storybook.

EDIT:

Fixing this version on my package.json solves the issue: styleguidist/react-docgen-typescript#356 (comment)

  "resolutions": {
    "react-docgen-typescript": "2.2.2"
  }

@dannyhw
Copy link
Member Author

dannyhw commented Mar 30, 2023

@douglasjunior hey thanks for sharing your solution. Yes the docgen stuff can have some issues with extending types from libraries. If you have more problems you can also just remove the docgen and manually set your argtypes since docgen for react native storybook is somewhat experimental

@douglasjunior
Copy link

douglasjunior commented Mar 30, 2023

@dannyhw seems that the source of the problem is the babel-plugin-react-docgen-typescript that depends on react-docgen-typescript 1.x.

The last version of babel-plugin-react-docgen-typescript was about 3 years ago.

@dannyhw
Copy link
Member Author

dannyhw commented Mar 30, 2023

@douglasjunior yeah this is why its kinda experimental because the real solution would require developing a new babel plugin or converting the webpack plugin that core storybook uses to work somehow with metro.

@dannyhw dannyhw unpinned this issue Jul 30, 2023
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