2018-09-11 16:32:52 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Navigation } from 'react-native-navigation';
|
2017-08-17 19:31:27 +00:00
|
|
|
import { getStorybookUI, configure } from '@storybook/react-native';
|
|
|
|
|
|
|
|
// import stories
|
|
|
|
configure(() => {
|
|
|
|
require('./stories');
|
|
|
|
}, module);
|
|
|
|
|
|
|
|
// This assumes that storybook is running on the same host as your RN packager,
|
|
|
|
// to set manually use, e.g. host: 'localhost' option
|
2018-09-11 16:32:52 +00:00
|
|
|
const StorybookUIRoot = getStorybookUI({ port: 7007, onDeviceUI: true });
|
2017-08-17 19:31:27 +00:00
|
|
|
|
2018-09-11 16:32:52 +00:00
|
|
|
// react-native hot module loader must take in a Class - https://github.com/facebook/react-native/issues/10991
|
|
|
|
// https://github.com/storybooks/storybook/issues/2081
|
|
|
|
// eslint-disable-next-line react/prefer-stateless-function
|
|
|
|
class StorybookUIHMRRoot extends Component {
|
|
|
|
render() {
|
|
|
|
return <StorybookUIRoot />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Navigation.registerComponent('storybook.UI', () => StorybookUIHMRRoot);
|
|
|
|
Navigation.startSingleScreenApp({
|
|
|
|
screen: {
|
|
|
|
screen: 'storybook.UI',
|
|
|
|
title: 'Storybook'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default StorybookUIHMRRoot;
|