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

Feature Request - Standalone React Native Build #3224

Closed
f0rr0 opened this issue Mar 16, 2018 · 7 comments
Closed

Feature Request - Standalone React Native Build #3224

f0rr0 opened this issue Mar 16, 2018 · 7 comments

Comments

@f0rr0
Copy link

f0rr0 commented Mar 16, 2018

Issue details

This is a feature request. I believe something similar for the web version already exists. To add context, this isn't for an Expo for CRNA app. Just wondering if there's possibility for an alternative to https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh

@danielduan
Copy link
Member

Can you go into more detail? What do you think we should separate here? Storybook RN from the RN bundler?

@f0rr0
Copy link
Author

f0rr0 commented Mar 16, 2018 via email

@danielduan
Copy link
Member

There's been discussions about separating the app from the desktop app.

Main problem - the Storybook app state is on the browser side and communicates over websocket to the RN app. We will need to refactor that if we want to split it.

Then, the concern here will be that addons like knobs will potentially not work anymore.

If you'd like to help us, let's discuss.

@f0rr0
Copy link
Author

f0rr0 commented Mar 16, 2018 via email

@f0rr0
Copy link
Author

f0rr0 commented Mar 27, 2018

Got this to work:

index.js

/* eslint-disable global-require */
import { AppRegistry } from 'react-native';
import { getStorybookUI, configure } from '@storybook/react-native';

configure(() => {
  require('./stories');
}, module);

const StorybookUI = getStorybookUI({
  port: 7007,
  onDeviceUI: true
});

AppRegistry.registerComponent('8fit', () => StorybookUI);

export default StorybookUI;

webpack.haul.storybook.js

module.exports = (_, { module }) => ({
  entry: './storybook/index.js',
  module: {
    ...module,
    rules: [
      {
        test: /\.js?$/,
        exclude: '/node_modules/',
        use: [
          {
            loader: 'babel-loader'
          }
        ]
      },
      ...module.rules
    ]
  }
  // any other haul config here.
});

For regular development:

storybook start -p 7007 --haul ./storybook/webpack.haul.storybook.js

Bundle standalone:
Change entry file here to index.js above: can be passed as an argument from xcode in the build phases script.
https://github.com/facebook/react-native/blob/56971bbb152babb0ee745d7abd55f5a5d35ae004/scripts/react-native-xcode.sh#L108

@stale
Copy link

stale bot commented Apr 17, 2018

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. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Apr 17, 2018
@stale
Copy link

stale bot commented May 17, 2018

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

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