-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Use @storybook/react stories with @storybook/react-native? #5821
Comments
@fo-fo here's my example of getting what you are talking about to work: https://github.com/MrLoh/universal-react-storybook I am requiring from My main issue now is more that I would like to use a merged storybook server to display the react-native-web stories and control the device to show the same stories. |
Thanks for this, |
It's not a perfect solution, as I feel that fundamentally the stories should have a dependency on React, not React Native, but the workaround is good enough for me so so I'll close this. |
Is your feature request related to a problem? Please describe.
I'm trying to use Storybook with React Native and react-native-web but ran into some problems. I want to use the same components (built from the React Native primitives) in the web Storybook (for easy viewing in a browser) and the mobile Storybook (for testing on mobile devices).
The main problem is that if I want to define stories for React Native on mobile, I have to import
storiesOf
from"@storybook/react-native"
, but if I want to define stories for React Native on web (with react-native-web), I have to importstoriesOf
from"@storybook/react"
.Is there something fundamental that stops the
configure
function from"@storybook/react-native"
from accepting stories defined bystoriesOf
from"@storybook/react"
? I tried it and couldn't get it to work. Conceptually it seems like something that shouldn't be dependent on React Native.Describe the solution you'd like
configure
imported from"@storybook/react-native"
should be able to work with stories defined usingstoriesOf
from"@storybook/react"
.Describe alternatives you've considered
I was able to sort of kind of work around this by importing
storiesOf
from both places, and by switching between them at runtime based on React Native Platform, i.e.,const storiesOf = Platform.OS === "web" ? storiesOfReact : storiesOfReactNative;
. However, this approach pulls all of React Native Storybook into the web build for no reason, and the build actually breaks because of this. (I was able to work around the build breakage, but it wasn't pretty.)As a side note, the React Native "in-device" Storybook doesn't seem to work with react-native-web, it would be cool if it did... And it would also kind of solve my problem too, because then I'd be able to view the stories in a browser using the React Native Storybook, although I'd rather use the web Storybook.
Are you able to assist bring the feature to reality?
Probably not right now, as I'm not well versed with Storybook.
The text was updated successfully, but these errors were encountered: