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

Does nesting of stories work in React Native? #2833

Closed
janmarsicek opened this issue Jan 24, 2018 · 11 comments
Closed

Does nesting of stories work in React Native? #2833

janmarsicek opened this issue Jan 24, 2018 · 11 comments

Comments

@janmarsicek
Copy link

Hello everyone, just wondering if this feature https://storybook.js.org/basics/writing-stories/#nesting-stories works in React Native apps? The story is nested in web preview but in the app drawer the string is just rendered with hierarchy separator.

Please compare web version:
image

and RN drawer:
image

Thanks 🚀

@igor-dv
Copy link
Member

igor-dv commented Jan 25, 2018

I think it does. What is the version of Storybook do you use? Can you please share you config.js?

@janmarsicek
Copy link
Author

@igor-dv Thanks for quick reply.

I think I don't have any specific config.js file.

Here is my main file:

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { getStorybookUI, configure } from '@storybook/react-native';

const stories = require.context('../../src/', true, /stories(\.(ios|android|native))?\.js$/);
configure(() => stories.keys().forEach(stories), module);

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

class StorybookUIHMRRoot extends Component {
    render() {
        return <StorybookUIRoot />;
    }
}

AppRegistry.registerComponent('storybook', () => StorybookUIHMRRoot);

export default StorybookUIHMRRoot;

@igor-dv
Copy link
Member

igor-dv commented Jan 25, 2018

I was under impression that hierarchySeparator is set to / by default, but maybe it's not how it works for RN. You can try adding it with the options addons:

import { setOptions } from '@storybook/addon-options';
...

setTimeout(
  () =>
    setOptions({
      hierarchySeparator: /\//,
    }),
  100
);

@janmarsicek
Copy link
Author

Sorry, I forgot to mention that I use version 3.3.10

Thanks for the hint. I will try it.

I briefly looked at the components for stories tree and I don't see anything related to creating hierarchy tree in RN part (see StoryListView). For web UI there is quite complex logic for handling this (see StoriesPanel container and component).

@igor-dv
Copy link
Member

igor-dv commented Jan 25, 2018

Ah 🤦‍♂️ , Sorry @janmarsicek , I've misunderstood your questions. Indeed, hierarchy is implemented only for web Storybook manager. Not for the RN view.

@janmarsicek
Copy link
Author

@igor-dv Thanks for your support! Is there a plan to implement similar feature also for RN also in the future?

@igor-dv
Copy link
Member

igor-dv commented Jan 25, 2018

I think there is already a similar feature request somewhere. Maybe @Gongreg knows more about this.

@Gongreg
Copy link
Member

Gongreg commented Jan 25, 2018

Hey, @janmarsicek, @igor-dv. Right now as far as I know there no plans to implement it (correct me if I'm wrong) but it should be implemented in the future, since we want to maintain feature parity between different projects (react, angular, ...). So it makes sense to do it.

@stale
Copy link

stale bot commented Mar 12, 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 60 days. Thanks!

@stale stale bot added the inactive label Mar 12, 2018
@stale stale bot removed the inactive label Mar 24, 2018
@Gongreg
Copy link
Member

Gongreg commented Oct 7, 2018

Closing in favour of #3905

@Gongreg Gongreg closed this as completed Oct 7, 2018
@issue-sh issue-sh bot removed the todo label Oct 7, 2018
@cloud-walker
Copy link

The new issue link shared by @Gongreg is: storybookjs/react-native#12

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

5 participants