How to use the @storybook/addons.loadAddons function in @storybook/addons

To help you get started, we’ve selected a few @storybook/addons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / app / react-native / src / preview / index.tsx View on Github external
addons.setChannel(channel);
      this._stories.setChannel(channel);

      channel.emit(Events.CHANNEL_CREATED);
    }

    channel.on(Events.GET_STORIES, () => this._sendSetStories());
    channel.on(Events.SET_CURRENT_STORY, d => this._selectStoryEvent(d));

    this._sendSetStories();

    // eslint-disable-next-line @typescript-eslint/no-this-alias
    const preview = this;

    addons.loadAddons(this._clientApi);

    const appliedTheme = { ...theme, ...params.theme };

    // react-native hot module loader must take in a Class - https://github.com/facebook/react-native/issues/10991
    return class StorybookRoot extends PureComponent {
      render() {
        if (onDeviceUI) {
          return (
github wix / wix-react-native-storybook-template / storybook-react-native / manager / provider.js View on Github external
handleAPI(api) {
    api.onStory((kind, story) => {
      this.selection = { kind, story };
      this.channel.emit('setCurrentStory', this.selection);
    });
    this.channel.on('setStories', data => {
      api.setStories(data.stories);
    });
    this.channel.on('getCurrentStory', () => {
      this.channel.emit('setCurrentStory', this.selection);
    });
    this.channel.emit('getStories');
    addons.loadAddons(api);
  }
}
github storybookjs / storybook / app / react-native-server / src / client / manager / provider.js View on Github external
handleAPI(api) {
    addons.loadAddons(api);
    api.emit(Events.GET_STORIES);
  }
}
github storybookjs / storybook / app / react-native / src / preview / components / OnDeviceUI / addons / index.js View on Github external
constructor() {
    super();

    addons.loadAddons({});
    this.panels = addons.getElements('panel');

    this.state = {
      addonSelected: Object.keys(this.panels)[0] || null,
    };
  }