react-native-animate-number icon indicating copy to clipboard operation
react-native-animate-number copied to clipboard

Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op. Please check the code for the AnimateNumber component.

Open marlti7 opened this issue 7 years ago • 4 comments

When I go back to a page,find this problem

marlti7 avatar Jun 21 '17 09:06 marlti7

I found a solution, when componentWillUnmount need clearout Timer

marlti7 avatar Jun 22 '17 01:06 marlti7

@marlti7 by add

 componentWillUnmount () {
    clearTimeout(Timer);
  }

not work for me

uglyspoon avatar Oct 25 '17 09:10 uglyspoon

find a way to fix this bug , this bug because the Timer won't unmount when your component unmounts. so set clearTimeout when componentWillUnmount(); code like this :

startAnimate() {
  this.timer = Timer.setTimeout(() => {
    console.log('I do not leak!');
  }, 500);
}

componentWillUnmount() {
  clearTimeout(this.timer);
}

happy coding !

uglyspoon avatar Nov 21 '17 18:11 uglyspoon

@uglyspoon I just add it on the bottom of AnimatedNumber class

componentWillUnmount () {
  clearTimeout(Timer);
}

And works for me. Now, when I go to another screen I am fine and the warning doesn't show anymore.

marquesm91 avatar May 18 '18 17:05 marquesm91