Skip to content

Commit

Permalink
fix: Scan - Clicking outside of the allow location modal submits the …
Browse files Browse the repository at this point in the history
…scan expense.

Signed-off-by: krishna2323 <[email protected]>
  • Loading branch information
Krishna2323 committed Sep 5, 2024
1 parent 2ef63e7 commit 24f754e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/ConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -108,6 +111,7 @@ function ConfirmModal({
success = true,
danger = false,
onCancel = () => {},
onBackdropPress = () => {},
shouldDisableConfirmButtonWhenOffline = false,
shouldShowCancelButton = true,
shouldSetModalVisibility = true,
Expand Down Expand Up @@ -139,6 +143,7 @@ function ConfirmModal({
<Modal
onSubmit={onConfirm}
onClose={onCancel}
onBackdropPress={onBackdropPress}
isVisible={isVisible}
shouldSetModalVisibility={shouldSetModalVisibility}
onModalHide={onModalHide}
Expand Down
4 changes: 4 additions & 0 deletions src/components/LocationPermissionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe
isVisible={showModal}
onConfirm={grantLocationPermission}
onCancel={skipLocationPermission}
onBackdropPress={() => {
setShowModal(false);
resetPermissionFlow();
}}
confirmText={getConfirmText()}
cancelText={translate('common.notNow')}
prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')}
Expand Down

0 comments on commit 24f754e

Please sign in to comment.