我正在按照官方网站这里的介绍进行操作:https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/
我已经重复了几次步骤,但仍然无法启动storybook。有人成功了吗?
有什么提示是我错过了什么吗?
如Tyler所请求的那样,我分享storybook索引文件如下(我没有更改任何内容,它是通过自动生成的新应用程序完成的):
import { AppRegistry } from "react-native";
import {
getStorybookUI,
configure,
addDecorator,
} from "@storybook/react-native";
import { withKnobs } from "@storybook/addon-knobs";
import "./rn-addons";
// enables knobs for all stories
addDecorator(withKnobs);
// import stories
configure(() => {
require("./stories");
}, module);
// Refer to https://github.com/storybookjs/react-native/tree/master/app/react-native#getstorybookui-options
// To find allowed options for getStorybookUI
const StorybookUIRoot = getStorybookUI({});
// If you are using React Native vanilla and after installation you don't see your app name here, write it manually.
// If you use Expo you should remove this line.
AppRegistry.registerComponent("%APP_NAME%", () => StorybookUIRoot);
export default StorybookUIRoot;
请添加
App.tsx
的屏幕截图。请参考以下链接查看图片:
![enter image description here](https://istack.dev59.com/8LPjI.webp)
git status
来检查初始化中发生了什么变化。然后检查这些文件,也许可以发布其中一个作为示例。如果没有任何更改,则可能是Storybook初始化出现了问题。 - Tyler Williamsexpo build:iOS
,但也无法解决问题。expo start --ios
可以正常工作。 - Weijing Jay Lin