首页 > 解决方案 > Why does @Storybook/react-native requires react-dom?

问题描述

Why does @Storybook/react-native require react-dom?

My understanding of react-dom is that it is used for the browser. But, since React Native doesn't use a browser this is just a peerDependency that will never be used.

When running a React Native app with remote debugging on, it will use Chrome as the running context and have a DOM available. Is this the reason for using it?

My package.json: "dependencies": { ... "react": "16.3.1", "react-native": "0.55.4", ... }, "devDependencies": { ... "@storybook/react-native": "4.1.1", ... }

I get these warnings when doing yarn install: warning "@storybook/react-native > @storybook/core@4.1.1" has unmet peer dependency "react-dom@>=16.3.0". warning "@storybook/react-native > @storybook/ui@4.1.1" has unmet peer dependency "react-dom@*". warning "@storybook/react-native > @storybook/ui > react-modal@3.8.1" has unmet peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16". warning "@storybook/react-native > @storybook/ui > react-treebeard@3.1.0" has unmet peer dependency "react-dom@^15.5.4 || ^16.0.0". warning "@storybook/react-native > @storybook/ui > react-treebeard > velocity-react@1.4.1" has unmet peer dependency "react-dom@^15.3.0 || ^16.0.0".

标签: javascriptreactjsreact-nativestorybook

解决方案


I got the following answer from Github Issue: https://github.com/storybooks/storybook/issues/5156

starting from v5 it won't need it. It is necessary so we could run web part of storybook. But the web part from v5 is going to be opt in


推荐阅读