Rocket.Chat.ReactNative/storybook/storybook.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

import React, { Component } from 'react';
import { Navigation } from 'react-native-navigation';
import { getStorybookUI, configure } from '@storybook/react-native'; // eslint-disable-line
2017-08-17 19:31:27 +00:00
// 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
const StorybookUIRoot = getStorybookUI({ port: 7007, onDeviceUI: true });
2017-08-17 19:31:27 +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);
2019-01-29 19:52:56 +00:00
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: 'storybook.UI'
}
}
});
});
export default StorybookUIHMRRoot;