为什么@ Storybook / react-native需要react-dom?

时间:2019-01-04 06:35:49

标签: javascript reactjs react-native storybook

为什么@Storybook/react-native要求react-dom

我对react-dom的理解是它用于浏览器。但是,由于React Native不使用浏览器,所以这只是一个永远不会使用的peerDependency。

在运行带有远程调试功能的React Native应用程序时,它将使用Chrome作为运行上下文并具有可用的DOM。这是使用它的原因吗?

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

在执行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".

1 个答案:

答案 0 :(得分:0)

我从Github问题获得以下答案:https://github.com/storybooks/storybook/issues/5156

  

从v5开始不需要它。因此,我们有必要运行故事书的Web部分。但是v5中的Web部件将被选择使用