Storybook React Native (IOS) - RangeError:超出最大调用堆栈大小(本机堆栈深度)
对于 IOS - 在 IOS 中为当前的 React Native 应用程序设置 Storybook 时出现此错误。使用 RN 0.66.1 版本,使用“@storybook/react-native”:“^5.3.25”,
storybook/index.js -
// if you use expo remove this line
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;
For IOS - got this error while setting up storybook for current react native app in IOS .using RN 0.66.1 version, using "@storybook/react-native": "^5.3.25",
storybook/index.js -
// if you use expo remove this line
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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我注意到如果您出于某种原因使用
Hermes
引擎,则会出现此错误。如果禁用Hermes
引擎,您应该能够使用 Storybook。请注意,您可能希望为生产启用Hermes
引擎。要在 ios 上启用/禁用Hermes
,它应该位于Podfile
中,对于 Android 则应位于android/app/build.gradle
中I noticed this error occurs if you are using the
Hermes
engine for whatever reason. If you disable theHermes
engine, you should be able to use Storybook. Note that you may want to enable theHermes
engine for production though. To enable/disableHermes
for ios, it should be in thePodfile
and for android inandroid/app/build.gradle