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

feat: csf support [6.0] #175

Merged
merged 9 commits into from
May 31, 2021
Merged

feat: csf support [6.0] #175

merged 9 commits into from
May 31, 2021

Conversation

dannyhw
Copy link
Member

@dannyhw dannyhw commented May 20, 2021

Issue: #106

What I did

Started working on adding in more of the csf functionality.

The configure function of the preview class is now the result of calling the loadcsf function from core client. This is similar to how the react storybook "start.js" works.

I've renamed the example with CSF in it so its easier to find.

Now configure if called this way and if you use the auto import stories it will generate the code for this.

configure("react-native", getCSFStories, module, true)

getCSFStories is a function that returns the require("filepath") calls for csf files.

Fast reload needs to be well tested to confirm that everything works as expected.
--edit 1
So it turns out fast reload is pretty much completely broken 😅

--edit 2
Managed to get fast reload working, it seems like module.hot.dispose data param is not supported in native so I went with a global variable. Not ideal but its at least working now. However I did have to edit loadcsf so it would require changes in storybook or we won't be able to re-use the current loadcsf.

currently there is an issue with non csf stories that I need to debug before merging.

-- final edit?
Non csf stories now also working, so it looks like csf and args are mostly done.

How to test

In progress

You can start the example app in examples/native and see that the stories are rendering.

@dannyhw dannyhw marked this pull request as draft May 20, 2021 22:22
@dannyhw dannyhw requested review from shilman and oblador May 21, 2021 15:04
@dannyhw dannyhw marked this pull request as ready for review May 21, 2021 17:43
@dannyhw dannyhw marked this pull request as draft May 22, 2021 11:56
@dannyhw dannyhw self-assigned this May 24, 2021
@dannyhw dannyhw force-pushed the feat/csf-iteration-1 branch from 6103ab5 to c431ff6 Compare May 30, 2021 12:07
@dannyhw dannyhw linked an issue May 30, 2021 that may be closed by this pull request
@dannyhw dannyhw marked this pull request as ready for review May 30, 2021 13:51
@dannyhw dannyhw merged commit e8da31f into next-6.0 May 31, 2021
@dannyhw dannyhw deleted the feat/csf-iteration-1 branch May 31, 2021 10:01
@dannyhw dannyhw mentioned this pull request May 31, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[6.0] CSF support on React Native
1 participant