Since updating to new version of React Native 0.55 we all have been starting to seeing a yellow error message box in our newly build react native application “Warning: isMounted(…) is deprecated in plain JavaScript React Classes. Instead, make sure to clean up subscriptions and pending request in componentWillUnmount to prevent memory leaks.” This error message is coming because of some comparability issue of react native current version. There is no need to worry this is simply a error message and can be easily hide. So in this tutorial we would going to Solve Warning isMounted(…) is deprecated in plain JavaScript Error in newly build Android iOS react native application.
The error message should look like below screenshot:
Solve Warning isMounted(…) is deprecated in plain JavaScript Error in Android iOS newly build React Native App:
1. This message can be hide using YellowBox component, YellowBox component is used to manage every yellow box error notifications messages.
2. Import YellowBox component in your project.
1
2
3
|
import React, { Component } from ‘react’;
import { YellowBox } from ‘react-native’;
|
3. Now Inside your class constructor() call the ignoreWarnings() function of YellowBox .
1
2
3
4
5
6
7
8
9
10
11
|
constructor(props) {
super(props);
YellowBox.ignoreWarnings(
[‘Warning: isMounted(…) is deprecated’, ‘Module RCTImageLoader’
]);
}
|
After using this code, Simply re-build your app and now you see the error is gone, Enjoy .