-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
How to use with react-native? #803
Comments
Comment by arunoda It's works for me without any issues.
|
Comment by ndbroadbent Also if you interested in using this in the browser instead of on your device, you should check out react-native-web. It can be tricky to set up, but it's working very well for me. |
Comment by xareelee Hi @ndbroadbent How to set up react-native-web to develop React Native components with storybook on a browser? |
Comment by Gongreg Hey, You can try to look into https://github.com/wix/react-native-storybook-example . It has knobs running in react-native. |
I'm struck here as well. Obviously there is a dependency on the 'document' which is missing in the react-native environment. Any workarounds/fixes? |
@Gongreg any help here? |
@Gongreg I'm using the default setup. Recently star But with Typescript, not sure if that would have an impact. I'm using the latest stable version of react-native rn-0.45. |
@sowdri, Could you try to get an example with this issue? |
This issue is quite easy to reproduce:
Either while running
I'm guessing the issue is with this incorrect peer dependency:
Now if I try to run storybook:
The following error occurs:
As this is a default setup. It will be good to fix this. |
@sowdri please upgrade |
Hey, @idris. |
@Gongreg
If I remove this line: |
@dzuncoi We recently added addon-knobs to our own example / kitchen-sink for react-native. But this is still on the release/3.3 branch: Perhaps this is of help already for you. |
@ndelangen |
@sowdri Did you make it work? |
For those who are struggling with "document is not defined" - it works if I get rid of It appears that you don't need to import "./addons" but rather that the storybook server takes it automatically from the stroybook config folder. https://github.com/storybooks/storybook/blob/release/3.3/app/react-native/docs/manual-setup.md - needs to be changed, it shouldn't require "./addons" in storybook.js |
@alonbardavid |
Sure, I found out where |
That's what I missed 😅 thank you. |
|
@notgiorgi storybook addon-info doesn't work with react native. |
Then we need this: #1895 if someone can provide the list, I could do the PR |
@notgiorgi, every addon has a list of apps it supports. https://github.com/storybooks/storybook/tree/master/addons/actions |
I have the same issue - @storybook/react-native@^3.2.11 Edit: Attempting to open the web browser as instructed gives
Edit # 2: Fixed by upgrading react-dom to match my react version in package.json: Error message details$ storybook start -p 7007 React Native Storybook started on => http://localhost:7007/ Scanning 1069 folders for symlinks in /Users/Luke/Projects/mobile2mr/node_modules (8ms) React packager ready. Loading dependency graph, done. ERROR in ./node_modules/react-dom/lib/ReactCompositeComponent.js ERROR in ./node_modules/react-dom/lib/ReactMount.js ERROR in ./node_modules/react-dom/lib/LinkedValueUtils.js ERROR in ./node_modules/react-dom/lib/ReactDOMOption.js ERROR in ./node_modules/react-dom/lib/ReactNodeTypes.js ERROR in ./node_modules/react-dom/lib/ReactDebugTool.js ERROR in ./node_modules/react-dom/lib/ReactDOMUnknownPropertyHook.js ERROR in ./node_modules/react-dom/lib/ReactDOMInvalidARIAHook.js ERROR in ./node_modules/react-dom/lib/checkReactTypeSpec.js ERROR in ./node_modules/react-dom/lib/flattenChildren.js ERROR in ./node_modules/react-dom/lib/ReactDOMNullInputValuePropHook.js ERROR in ./node_modules/react-dom/lib/ReactChildReconciler.js ERROR in ./node_modules/react-dom/lib/ReactMultiChild.js ERROR in ./node_modules/react-dom/lib/traverseAllChildren.js ERROR in ./node_modules/react-dom/lib/ReactUpdateQueue.js ERROR in ./node_modules/react-dom/lib/ReactMount.js ERROR in ./node_modules/react-dom/lib/ReactCompositeComponent.js ERROR in ./node_modules/react-dom/lib/findDOMNode.js ERROR in ./node_modules/react-dom/lib/instantiateReactComponent.js |
@lukecwilliams The issue is resolved for you? Or are you manually changing a package.json file in our package? If you have founds a fix in our code, could you open a PR? 👍 |
@ndelangen I could look at a fix - currently I have to modify AppDelegate.m every time I want to switch between Storybook and my app. I'd prefer to only need to run the separate packager and have Storybook read the location of my file automatically (./dist/storybook/index.ios.js). To confirm, is that not currently possible? |
Issue by hadfieldn
Tuesday Jan 03, 2017 at 18:40 GMT
Originally opened as storybook-eol/storybook-addon-knobs#83
It looks like others have had success getting knobs to work with react-native storybook, but when I include
import '@kadira/storybook-addon-knobs/register';
in my addons.js file I get the errordocument is not defined
-- due to a dependency on insert-css, which requiresdocument
.Is there another way to register the addon that works with react native?
The text was updated successfully, but these errors were encountered: