Cra*_*oiD 8 intellij-idea react-native expo
我不断得到允许需要循环,但可能会导致未初始化的值。考虑重构以消除对循环的需要。在我的终端上发出警告,它使调试我的程序变得如此困难。
我用过了
YellowBox.ignoreWarnings([
'Require cycle:',
])
Run Code Online (Sandbox Code Playgroud)
并且
console.disableYellowBox = true;
Run Code Online (Sandbox Code Playgroud)
但都没有奏效。YellowBox.ignoreWarnings 仅适用于移动设备上显示的警告,但不适用于我的 IDE 终端上的警告。如何防止在终端上收到这些警告。
我注释掉了以下几行,它们不再出现在终端和设备中。
node_modules/metro/src/lib/polyfills/require.js(第 114 行)
Run Code Online (Sandbox Code Playgroud)console.warn( "Require cycle: ".concat(cycle.join(" -> "), "\n\n") + "Require cycles are allowed, but can result in uninitialized values. " + "Consider refactoring to remove the need for a cycle." );
注释掉该警告后,重新启动项目修复了我的问题。附注。我正在使用世博会。
小智 6
我针对这个问题的解决方案,希望对其他人有帮助:
import { AppRegistry, LogBox } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
LogBox.ignoreLogs(['Require cycle:']);
AppRegistry.registerComponent(appName, () => App);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3412 次 |
| 最近记录: |