I'm continuously getting Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. warning on my terminal and it has make debugging my program so difficult.
I have used
YellowBox.ignoreWarnings([
'Require cycle:',
])
and also
console.disableYellowBox = true;
But neither worked. YellowBox.ignoreWarnings worked only for the warnings displayed on the mobile but not for the warnings on the terminal of my IDE. How can i prevent getting these warnings on the terminal.
I commented out the below lines and they stopped appearing in both terminal and the device.
node_modules/metro/src/lib/polyfills/require.js (Line 114)
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." );
After commenting out that warning, restarting the project fixed my issues. PS. I'm using expo.
My solution for this issue, hope it helps others:
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With