How to Disable Yellow Warning Box in React Native

React Native Yellow Warning Box

This is How to Disable Yellow Warning Box in React Native. This Yellow warning box can be helpful if you want to know any warning but can be annoying at the same time if you know the issue and want to ignore that.

In the second case where you want to ignore the error and it is also blocking necessary pieces of the application, you can disable it.

How to Disable Yellow Warning Box in React Native

To disable warning in React Native you just need to add the following line in your App.js file

console.disableYellowBox = true;

Code with Yellow Warning

So here is a demo code which has Yellow Warning (Suppose)

import React, { Component } from "react";
import { View } from "react-native";

export default class App extends Component {
  render() {
    return (
      <View>
        {/*Your Code will be here*/}
      </View>
    );
  }
}

Screenshot with Yellow Warning

Code after Disabling Yellow Warning

To disable the warning please add console.disableYellowBox = true;

import React, { Component } from "react";
import { View } from "react-native";

console.disableYellowBox = true;

export default class App extends Component {
  render() {
    return (
      <View>
        {/*Your Code will be here*/}
      </View>
    );
  }
}

Screenshot without Yellow Warning

So this is how to disable yellow warning box in React Native. If you have any problem or want to share anything then please comment below.

Hope you liked it. 🙂


Related Posts

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.