LogBox ignore warnings not working in react native?

Viewed 2402

I have an app made with react-native CLI, my version of RN is 0.63, I'm getting annoying moment.js warning like bellow:

Require cycle: node_modules\moment\src\lib\create\local.js -> node_modules\moment\src\lib\create\from-anything.js -> node_modules\moment\src\lib\create\from-string-and-array.js -> node_modules\moment\src\lib\create\from-string-and-format.js -> node_modules\moment\src\lib\create\from-array.js -> node_modules\moment\src\lib\create\local.js

I'm trying to make it so it will ignore this warning by using LogBox but it's not working.

I'm doing this in my App.js file:

import { LogBox  } from 'react-native';
LogBox.ignoreLogs(['Require cycle:']);

Any idea how can I make it so react-native will ignore the warnings?

1 Answers

Be careful where the error occurs, more precisely in which screen because the warning may appear after you have ignored it.

I don't understand why it's not global, but for me that was the problem.

Related