From c85c658754bf5deaee1a3fd7365053fd7f9c91a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bert?= <63123542+Warus15@users.noreply.github.com> Date: Mon, 12 Sep 2022 13:10:10 +0200 Subject: [PATCH] Add check for module (#2215) ## Description This PR should fix issue #2213 by checking whether module is undefined or not. Navigation has Gesture Handler in dependencies, so the module will be loaded even if Gesture Handler is not used. Change in this PR prevents apps from crashing in that case. --- src/RNGestureHandlerModule.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/RNGestureHandlerModule.ts b/src/RNGestureHandlerModule.ts index 73052bc764..f777d1eeb7 100644 --- a/src/RNGestureHandlerModule.ts +++ b/src/RNGestureHandlerModule.ts @@ -16,7 +16,10 @@ if (RNGestureHandlerModule == null) { ); } -if (RNGestureHandlerModule.flushOperations === undefined) { +if ( + RNGestureHandlerModule && + RNGestureHandlerModule.flushOperations === undefined +) { RNGestureHandlerModule.flushOperations = () => { // NO-OP if not defined };