mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-21 06:15:15 +00:00
never setState after component is unmounted
This commit is contained in:
@@ -23,12 +23,18 @@ class GExample extends Component{
|
||||
|
||||
componentDidMount = () => {
|
||||
setTimeout(() => {
|
||||
if (!this._unmounted) {
|
||||
this.setState({
|
||||
fill: '#856'
|
||||
});
|
||||
}
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
componentWillUnmount = () => {
|
||||
this._unmounted = true;
|
||||
};
|
||||
|
||||
render() {
|
||||
return <Svg
|
||||
height="100"
|
||||
|
||||
Reference in New Issue
Block a user