Ajith
Ajith

Reputation: 2666

React Native disable console.warn yellow box from the app screen bottom

I want to remove console.warn and all other warning messages that happen to appear on my react native app with a single line of code. Before I have achieved this by adding the following in my App.js

console.disableYellowBox = true;

But somehow it is not working now, the code still exists in my App.js but the warning on yellow box is still showing on the bottom of the screen. Since my app is large which uses several packages and I have also added console.warn in many places, I need a solution to disable this from a single place

Someone please kelp me to identify why console.disableYellowBox = true; is not working or please provide some alternate solution to fix this .

My react native version is 0.60.5

Any help would be much appreciated.

Thanks in advance

Upvotes: 3

Views: 10733

Answers (2)

Akshay I
Akshay I

Reputation: 4175

For React-naitve 0.63

LogBox.ignoreAllLogs()

and earlier version

YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader', 'RNDeviceInfo', 'Warning: An update']);

Upvotes: 5

Ajeett
Ajeett

Reputation: 812

Try this it will remove the obvious warnings.

YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader', 'RNDeviceInfo', 'Warning: An update']);

Upvotes: 5

Related Questions