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

Co-locate stories with components. #838

Closed
shilman opened this issue Apr 15, 2017 · 7 comments
Closed

Co-locate stories with components. #838

shilman opened this issue Apr 15, 2017 · 7 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 15, 2017

Issue by philcockfield
Tuesday Oct 04, 2016 at 04:09 GMT
Originally opened as storybook-eol/react-native-storybook#103


Is there an equivalent way to find stories that sit alongside their components with a .stories extension like you can on web:

const req = require.context('../lib/view', true, /.stories.js$/);
configure(() => {
  req.keys().forEach(filename => req(filename));
}, module);

(ref: https://getstorybook.io/docs/basics/writing-stories)

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by mnmtanish
Tuesday Oct 04, 2016 at 05:18 GMT


React Storybook uses require.context to do that which is a Webpack feature. So far, we don't know of any equivalent feature in React Native bundler. I'll see what we can do to enable this.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by philcockfield
Tuesday Oct 04, 2016 at 05:26 GMT


That would be awesome if it's in any way possible!! - thanks @mnmtanish

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by ckothari
Sunday Oct 30, 2016 at 09:26 GMT


+1

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by skovhus
Thursday Mar 23, 2017 at 14:32 GMT


Semi automated way here https://github.com/elderfo/react-native-storybook-loader

But would be great to avoid the build step.

@ndelangen
Copy link
Member

@shilman Does the new tool introduced to bundle react-native add any options to solve this?

@stale
Copy link

stale bot commented Oct 31, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

@stale stale bot added the inactive label Oct 31, 2017
@ndelangen
Copy link
Member

This should be possible using https://github.com/callstack/haul which we support.

A PR adding an example or a comment here with a how-to would be of great help to people 🙇

Will close this issue, as we're unable to implement this in Storybook itself, this is something the packager needs to support. (haul does)

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

2 participants