Skip to content

Commit

Permalink
Add check for module (#2215)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
m-bert authored Sep 12, 2022
1 parent bbf36d9 commit c85c658
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/RNGestureHandlerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ if (RNGestureHandlerModule == null) {
);
}

if (RNGestureHandlerModule.flushOperations === undefined) {
if (
RNGestureHandlerModule &&
RNGestureHandlerModule.flushOperations === undefined
) {
RNGestureHandlerModule.flushOperations = () => {
// NO-OP if not defined
};
Expand Down

0 comments on commit c85c658

Please sign in to comment.