Clear timeouts on unmount in TouchableMixin
Summary: Fixes #1152 Closes https://github.com/facebook/react-native/pull/3176 Reviewed By: @svcscm Differential Revision: D2506385 Pulled By: @vjeux
This commit is contained in:
parent
ac069aaf12
commit
a9b8ca027c
|
@ -303,6 +303,15 @@ var LONG_PRESS_ALLOWED_MOVEMENT = 10;
|
|||
* @lends Touchable.prototype
|
||||
*/
|
||||
var TouchableMixin = {
|
||||
/**
|
||||
* Clear all timeouts on unmount
|
||||
*/
|
||||
componentWillUnmount: function() {
|
||||
this.touchableDelayTimeout && clearTimeout(this.touchableDelayTimeout);
|
||||
this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout);
|
||||
this.pressOutDelayTimeout && clearTimeout(this.pressOutDelayTimeout);
|
||||
},
|
||||
|
||||
/**
|
||||
* It's prefer that mixins determine state in this way, having the class
|
||||
* explicitly mix the state in the one and only `getInitialState` method.
|
||||
|
|
Loading…
Reference in New Issue