From 5ea58f0baae79e0da7468b215b17c70e6cdf0a9a Mon Sep 17 00:00:00 2001 From: Adrian Smijulj Date: Sat, 29 Dec 2018 00:16:34 +0100 Subject: [PATCH] fix: execute onDragOver / onDrop callbacks only if defined --- src/Files.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Files.js b/src/Files.js index 4324460..0ba31c3 100644 --- a/src/Files.js +++ b/src/Files.js @@ -198,17 +198,19 @@ class Files extends React.Component { // Opens the file browser. this.input && this.input.click(); }, - getDropZoneProps: (props: Object) => { + getDropZoneProps: (props: ?Object) => { return { ...props, onDragOver: e => { e.preventDefault(); - typeof props.onDragOver === "function" && props.onDragOver(); + props && + typeof props.onDragOver === "function" && + props.onDragOver(); }, onDrop: async e => { e.preventDefault(); await this.processSelectedFiles(e.dataTransfer.files); - typeof props.onDrop === "function" && props.onDrop(); + props && typeof props.onDrop === "function" && props.onDrop(); } }; }