Storybook: [native] how to load stories by `.stories` suffix

Created on 16 Jan 2018  路  2Comments  路  Source: storybookjs/storybook

In my regular react project, I usually colocate stories with their components, like this:

Component.js
Component.test.js
Component.stories.js

I do this via the config:

import { configure } from '@storybook/react'

const req = require.context('../src', true, /\.stories\.js$/)

function loadStories() {
  req.keys().forEach(filename => req(filename))
}

configure(loadStories, module)

since react-native doesn't support require.context, I was wondering if it'd be possible to reproduce this behaviour somehow for storybook for react-native.

react-native question / support

Most helpful comment

All 2 comments

thanks, worked like a charm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purplecones picture purplecones  路  3Comments

zvictor picture zvictor  路  3Comments

shilman picture shilman  路  3Comments

ZigGreen picture ZigGreen  路  3Comments

rpersaud picture rpersaud  路  3Comments