From b059f0827f5e41db639d6212faa78e7845798e0c Mon Sep 17 00:00:00 2001 From: miroslav Date: Thu, 8 Dec 2022 23:08:37 +0100 Subject: [PATCH 1/2] fix "Upload photo" popup menu not hiding --- src/components/AttachmentPicker/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/AttachmentPicker/index.js b/src/components/AttachmentPicker/index.js index 25191883f709..384505a0cfbe 100644 --- a/src/components/AttachmentPicker/index.js +++ b/src/components/AttachmentPicker/index.js @@ -41,6 +41,9 @@ class AttachmentPicker extends React.Component { // Cleanup after selecting a file to start from a fresh state this.fileInput.value = null; }} + + // Prevent parent's onclick event from firing + onClick={e => e.stopPropagation()} accept={getAcceptableFileTypes(this.props.type)} /> {this.props.children({ From fee05c8333bd9de07d5c5ce0f85f15bf851000c9 Mon Sep 17 00:00:00 2001 From: miroslav Date: Fri, 9 Dec 2022 05:54:46 +0100 Subject: [PATCH 2/2] update comment for stopPropagation in file input --- src/components/AttachmentPicker/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/AttachmentPicker/index.js b/src/components/AttachmentPicker/index.js index 384505a0cfbe..082853285bc4 100644 --- a/src/components/AttachmentPicker/index.js +++ b/src/components/AttachmentPicker/index.js @@ -42,7 +42,8 @@ class AttachmentPicker extends React.Component { this.fileInput.value = null; }} - // Prevent parent's onclick event from firing + // We are stopping the event propagation because triggering the `click()` on the hidden input + // causes the event to unexpectedly bubble up to anything wrapping this component e.g. Pressable onClick={e => e.stopPropagation()} accept={getAcceptableFileTypes(this.props.type)} />