Permalink
Browse files

Clear timeouts on unmount in TouchableMixin

Summary: Fixes #1152
Closes #3176

Reviewed By: @​svcscm

Differential Revision: D2506385

Pulled By: @vjeux
  • Loading branch information...
dralletje authored and facebook-github-bot-8 committed Oct 3, 2015
1 parent ac069aa commit a9b8ca027cfcb43fca8396496dceb094d488405f
Showing with 9 additions and 0 deletions.
  1. +9 −0 Libraries/vendor/react_contrib/interactions/Touchable/Touchable.js
@@ -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.

0 comments on commit a9b8ca0

Please sign in to comment.