Skip to content

Commit 968b3e9

Browse files
bhanu-allaparthinecolas
authored andcommitted
[fix] Avoid retaining DOM nodes in Touchable
Explicitly clear the DOM nodes to prevent memory leaks. Fix #2039 Close #2047
1 parent 5b7b974 commit 968b3e9

File tree

1 file changed

+4
-0
lines changed
  • packages/react-native-web/src/exports/Touchable

1 file changed

+4
-0
lines changed

packages/react-native-web/src/exports/Touchable/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ const TouchableMixin = {
393393
this.touchableDelayTimeout && clearTimeout(this.touchableDelayTimeout);
394394
this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout);
395395
this.pressOutDelayTimeout && clearTimeout(this.pressOutDelayTimeout);
396+
// Clear DOM nodes
397+
this.pressInLocation = null;
398+
this.state.touchable.responderID = null;
399+
this._touchableNode = null;
396400
},
397401

398402
/**

0 commit comments

Comments
 (0)