From fa2dbe198b7cc9344417276d8430238cbe8d90ae Mon Sep 17 00:00:00 2001 From: Domas Date: Thu, 15 Jul 2021 19:40:39 +0300 Subject: [PATCH] Handle when elements disappear without unmounting --- src/TouchScrollable.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TouchScrollable.js b/src/TouchScrollable.js index 420ab8b..e3e296f 100644 --- a/src/TouchScrollable.js +++ b/src/TouchScrollable.js @@ -32,6 +32,7 @@ export class TouchScrollable extends PureComponent { } componentWillUnmount() { if (!canUseEventListeners) return; + if (!this.scrollableArea) return; this.scrollableArea.removeEventListener( 'touchstart',