面板、插件和组件未显示在具有本机反应的 Storybook 中

Panel, addons and components not showing in Storybook with react-native

我正在 React Native 项目中设置 Storybook, 但是显示预览组件的右侧面板没有显示任何内容,在我看到的一些视频教程中,它没有发生。我该如何解决这个问题?需要更多配置吗?

在此处查看更多内容:https://i.imgur.com/KQq2p8F.png

我认为您图片中显示的案例(组件预览在设备上可见,但在网络浏览器中不可见)是基于以下问题的正常行为:

故事书 github 回购 here 中发布了类似的问题。问题标题为 故事未在网络浏览器中显示 - react-native #3353

故事书团队成员@igor-dv的回答:

React native stories can't be shown in the browser with an out-of-the-box use case - because they are react-native. As you can see in the first Welcome to storybook screen or in the Readme, you should perform more steps to see them on the device.

此外,同一团队成员关于在 Web 上启用组件的唯一建议是:

If you do want to see them in the browser, you may set up the react-native-web. But you should understand that it won't be real native stories.

我也不相信这个用例会很快得到支持,作为另一位团队成员,@danielduan 写道:

I personally think the web UI is of little value to most developers. We should just default to device UI only

P.S. 所有类似的问题都可以在问题 #7723 here 下找到。第三名团队成员@Gongreg 进一步确认了这种有意为之的行为:

This is not a bug but intended behaviour, there is no content to show in the web (it is React Native app that you are playing around, not the web).

在 Storybook 中,React 本机组件不会出现在 Storybook 网页的预览中。相反,当您 select 用于在网页上预览的组件故事时,相应组件故事的预览会出现在移动模拟器上。这是预期的行为。