Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Not works on react-native [has solution] #41

Closed
ColCh opened this issue Sep 25, 2016 · 3 comments
Closed

Not works on react-native [has solution] #41

ColCh opened this issue Sep 25, 2016 · 3 comments

Comments

@ColCh
Copy link
Contributor

ColCh commented Sep 25, 2016

Error text:

ExceptionsManager.js:61 Expected a component class, got [object Object].

image

WHY

Because of this wrapper:
https://github.com/kadirahq/storybook-addon-knobs/blob/7757f1ef03880f3682cc836f5e88f52078f4be51/src/components/WrapStory.js#L54
WrapStory.js:

  render() {
    const { storyFn, context } = this.props;
    return <div>{storyFn(context)}</div>;
  }

react-native have no <div> component. It's only defined in WEB environment.

SOLUTION

remove wrapper and return storyFn result:

  render() {
    const { storyFn, context } = this.props;
-    return <div>{storyFn(context)}</div>;
+    return storyFn(context);
  }
@ColCh ColCh changed the title Not works on react-native Not works on react-native [has solution] Sep 25, 2016
@ColCh
Copy link
Contributor Author

ColCh commented Sep 25, 2016

With fix applied works like a charm: https://streamable.com/esn8

ColCh added a commit to ColCh/storybook-addon-knobs that referenced this issue Sep 25, 2016
@arunoda
Copy link
Contributor

arunoda commented Sep 25, 2016

Okay. Looks prefect. Let's ship this.

@thani-sh
Copy link
Contributor

Released v1.2.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants