Storybook React Native (IOS) - RangeError:超出最大调用堆栈大小(本机堆栈深度)

发布于 2025-01-13 02:04:24 字数 1016 浏览 0 评论 0原文

对于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

今天小雨转甜 2025-01-20 02:04:24

我注意到如果您出于某种原因使用 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 the Hermes engine, you should be able to use Storybook. Note that you may want to enable the Hermes engine for production though. To enable/disable Hermes for ios, it should be in the Podfile and for android in android/app/build.gradle

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文