mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
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:
committed by
facebook-github-bot-8
parent
ac069aaf12
commit
a9b8ca027c
@@ -303,6 +303,15 @@ var LONG_PRESS_ALLOWED_MOVEMENT = 10;
|
|||||||
* @lends Touchable.prototype
|
* @lends Touchable.prototype
|
||||||
*/
|
*/
|
||||||
var TouchableMixin = {
|
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
|
* It's prefer that mixins determine state in this way, having the class
|
||||||
* explicitly mix the state in the one and only `getInitialState` method.
|
* explicitly mix the state in the one and only `getInitialState` method.
|
||||||
|
|||||||
Reference in New Issue
Block a user