From 24f754e748c298608bf2ad153b6932d27fbde176 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 5 Sep 2024 11:51:15 +0530 Subject: [PATCH 1/3] fix: Scan - Clicking outside of the allow location modal submits the scan expense. Signed-off-by: krishna2323 --- src/components/ConfirmModal.tsx | 5 +++++ src/components/LocationPermissionModal/index.tsx | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/components/ConfirmModal.tsx b/src/components/ConfirmModal.tsx index 487d637b2ea2..960e49e19bce 100755 --- a/src/components/ConfirmModal.tsx +++ b/src/components/ConfirmModal.tsx @@ -19,6 +19,9 @@ type ConfirmModalProps = { /** A callback to call when the form has been closed */ onCancel?: () => void; + /** A callback to call when backdrop is pressed */ + onBackdropPress?: () => void; + /** Modal visibility */ isVisible: boolean; @@ -108,6 +111,7 @@ function ConfirmModal({ success = true, danger = false, onCancel = () => {}, + onBackdropPress = () => {}, shouldDisableConfirmButtonWhenOffline = false, shouldShowCancelButton = true, shouldSetModalVisibility = true, @@ -139,6 +143,7 @@ function ConfirmModal({ { + setShowModal(false); + resetPermissionFlow(); + }} confirmText={getConfirmText()} cancelText={translate('common.notNow')} prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')} From 937e6c24d420cbe89a9186a7e79810d72e17936d Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 5 Sep 2024 12:01:05 +0530 Subject: [PATCH 2/3] add changes for android native. Signed-off-by: krishna2323 --- src/components/LocationPermissionModal/index.android.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/LocationPermissionModal/index.android.tsx b/src/components/LocationPermissionModal/index.android.tsx index 811537e00e67..3b62f2b49aaf 100644 --- a/src/components/LocationPermissionModal/index.android.tsx +++ b/src/components/LocationPermissionModal/index.android.tsx @@ -68,6 +68,10 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe isVisible={showModal} onConfirm={grantLocationPermission} onCancel={skipLocationPermission} + onBackdropPress={() => { + setShowModal(false); + resetPermissionFlow(); + }} confirmText={hasError ? translate('common.settings') : translate('common.continue')} cancelText={translate('common.notNow')} prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')} From a6a92ad62a0874ebad5545c6c08f5fd50c2b0e29 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 6 Sep 2024 11:04:46 +0530 Subject: [PATCH 3/3] minor update. Signed-off-by: krishna2323 --- .../LocationPermissionModal/index.android.tsx | 10 ++++++---- src/components/LocationPermissionModal/index.tsx | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/LocationPermissionModal/index.android.tsx b/src/components/LocationPermissionModal/index.android.tsx index 3b62f2b49aaf..30896cf37084 100644 --- a/src/components/LocationPermissionModal/index.android.tsx +++ b/src/components/LocationPermissionModal/index.android.tsx @@ -63,15 +63,17 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe setHasError(false); }; + const closeModal = () => { + setShowModal(false); + resetPermissionFlow(); + }; + return ( { - setShowModal(false); - resetPermissionFlow(); - }} + onBackdropPress={closeModal} confirmText={hasError ? translate('common.settings') : translate('common.continue')} cancelText={translate('common.notNow')} prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')} diff --git a/src/components/LocationPermissionModal/index.tsx b/src/components/LocationPermissionModal/index.tsx index 52dd16b1ee34..0e500a9b7cc4 100644 --- a/src/components/LocationPermissionModal/index.tsx +++ b/src/components/LocationPermissionModal/index.tsx @@ -77,15 +77,16 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe return isWeb ? translate('common.buttonConfirm') : translate('common.settings'); }; + const closeModal = () => { + setShowModal(false); + resetPermissionFlow(); + }; return ( { - setShowModal(false); - resetPermissionFlow(); - }} + onBackdropPress={closeModal} confirmText={getConfirmText()} cancelText={translate('common.notNow')} prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')}