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

Running alongside an existing expo app #1

Closed
MiguelNiblock opened this issue Jun 19, 2022 · 4 comments
Closed

Running alongside an existing expo app #1

MiguelNiblock opened this issue Jun 19, 2022 · 4 comments

Comments

@MiguelNiblock
Copy link

Hey @dannyhw , this is an awesome project. I'm new to storybook and was trying to use it alongside my existing expo app, for UI development. But after taking a closer look at your project, I'm confused as to how storybook should be used. It seems like this is intended to use storybook as the main app in App.tsx. Is this the only way it can be set up with expo? I would like to still be able to run my regular app, and run storybook on the side. If that's not possible, would you have to create a monorepo? I.e. installing your template as a subproject? I would highly prefer to not go that route because monorepos are harder to maintain. How would you normally set this up if you were developing an actual app, (Not a UI library), and only wanted to use storybook to test the UI that goes into the app? Thanks and I hope to help document anything that might help storybook adoption in expo! It's an awesome tool.

@dannyhw
Copy link
Owner

dannyhw commented Jun 19, 2022

Hey 👋, in the documentation I suggest setting it up that way because its just easier to explain for getting started. However I tried to mention some alternatives in the readme and so on. Basically it comes down to optionally exporting the storybook ui or opening it from a settings menu or gesture that only works in dev mode for example.

For rn cli i wrote a blog about how you can have two entry points for an app however it unfortunately isn't so easy to do with expo.

Essentially its left up to the user how you want to hide/show the storybook ui, how you might with any other component. Ignite have an interesting solution for this but there are many other ways.

@MiguelNiblock
Copy link
Author

Thank you ! I did figure something out:

package.json...
"sb.device": "SB=device yarn start",

app.config.ts...
entryPoint: process.env.SB === 'device' ? './.storybook-react-native/App.tsx' : './App.tsx',

and then wrap both entry points in import { registerRootComponent } from 'expo'

and voila

@dannyhw
Copy link
Owner

dannyhw commented Jun 20, 2022

Nice! I will have to try it out myself

@dannyhw
Copy link
Owner

dannyhw commented Jun 20, 2022

@MiguelNiblock seems like you have an interesting solution to this, would you consider opening a PR to include it in the template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants