From d40b1da1d06d145e736b653b630c4d06aaf25b4a Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 5 Feb 2019 19:12:56 -0300 Subject: [PATCH] Fix previewing doc files more than once on Android (#2550) --- .../file_attachment_list/file_attachment_document.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/components/file_attachment_list/file_attachment_document.js b/app/components/file_attachment_list/file_attachment_document.js index 87c147665..af7ac727a 100644 --- a/app/components/file_attachment_list/file_attachment_document.js +++ b/app/components/file_attachment_list/file_attachment_document.js @@ -267,12 +267,18 @@ export default class FileAttachmentDocument extends PureComponent { }), }] ); - this.setStatusBarColor(); + this.onDonePreviewingFile(); RNFetchBlob.fs.unlink(path); } this.setState({downloading: false, progress: 0}); }); + + // Android does not trigger the event for DoneButtonEvent + // so we'll wait 4 seconds before enabling the tap for open the preview again + if (Platform.OS === 'android') { + setTimeout(this.onDonePreviewingFile, 4000); + } } }, delay); };