Vladimir Kovalev Vladimir Kovalev - 1 year ago 368
React JSX Question

How to suppress warning due to a third-party PropTypes library in react native

I got a plenty of warnings while using Stylesheet in React Native as following image.

Warning on iOS simulator

How to suppress it?

ide ide
Answer Source

There is no way to disable warnings for a specific component, but you can disable different types of warnings in your app. To disable all warnings, use:

console.disableYellowBox = true;

To disable only certain warnings that start with a given string, specify an array of prefixes to filter out:

console.ignoredYellowBox = ['Warning: ...'];

For example, for the warning in the question you could write:

console.ignoredYellowBox = [
  'Warning: You are manually calling a React.PropTypes validation',