Skip to content

Commit

Permalink
Merge pull request #53438 from daledah/fix/53007
Browse files Browse the repository at this point in the history
fix: correct back button behavior on copilot confirmation page
  • Loading branch information
MarioExpensify authored Dec 9, 2024
2 parents 219dabf + 42e346c commit 7180a37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/ValidateCodeActionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function ValidateCodeActionModal({
sendValidateCode,
hasMagicCodeBeenSent,
isLoading,
shouldHandleNavigationBack,
}: ValidateCodeActionModalProps) {
const themeStyles = useThemeStyles();
const firstRenderRef = useRef(true);
Expand All @@ -52,6 +53,7 @@ function ValidateCodeActionModal({

return (
<Modal
shouldHandleNavigationBack={shouldHandleNavigationBack}
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED}
isVisible={isVisible}
onClose={hide}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ValidateCodeActionModal/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type ValidateCodeActionModalProps = {

/** Whether the form is loading or not */
isLoading?: boolean;

/** Whether handle navigation back when modal show. */
shouldHandleNavigationBack?: boolean;
};

// eslint-disable-next-line import/prefer-default-export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function ConfirmDelegatePage({route}: ConfirmDelegatePageProps) {
shouldShowRightIcon
/>
<DelegateMagicCodeModal
shouldHandleNavigationBack
login={login}
role={role}
onClose={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ type DelegateMagicCodeModalProps = {
role: ValueOf<typeof CONST.DELEGATE_ROLE>;
isValidateCodeActionModalVisible: boolean;
onClose?: () => void;
shouldHandleNavigationBack?: boolean;
};

function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModalVisible}: DelegateMagicCodeModalProps) {
function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModalVisible, shouldHandleNavigationBack}: DelegateMagicCodeModalProps) {
const {translate} = useLocalize();
const [account] = useOnyx(ONYXKEYS.ACCOUNT);

Expand Down Expand Up @@ -48,6 +49,7 @@ function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModal

return (
<ValidateCodeActionModal
shouldHandleNavigationBack={shouldHandleNavigationBack}
clearError={clearError}
onClose={onBackButtonPress}
validateError={validateLoginError}
Expand Down

0 comments on commit 7180a37

Please sign in to comment.