Skip to content

Commit a55542a

Browse files
authored
Merge pull request Expensify#68403 from Krishna2323/krishna2323/issue/67883
fix: Sign In - App closes when tapped on device back button on "Enter magic code" screen.
2 parents 9c58de6 + 78222f8 commit a55542a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/pages/signin/SignInPage.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import CustomStatusBarAndBackground from '@components/CustomStatusBarAndBackgrou
77
import ScreenWrapper from '@components/ScreenWrapper';
88
import ThemeProvider from '@components/ThemeProvider';
99
import ThemeStylesProvider from '@components/ThemeStylesProvider';
10+
import useHandleBackButton from '@hooks/useHandleBackButton';
1011
import useLocalize from '@hooks/useLocalize';
1112
import useOnyx from '@hooks/useOnyx';
1213
import useResponsiveLayout from '@hooks/useResponsiveLayout';
@@ -281,19 +282,22 @@ function SignInPage({shouldEnableMaxHeight = true, ref}: SignInPageInnerProps) {
281282
(shouldShowEmailDeliveryFailurePage || shouldShowUnlinkLoginForm || shouldShowChooseSSOOrMagicCode || shouldShowSMSDeliveryFailurePage))
282283
) {
283284
clearSignInData();
284-
return;
285+
return true;
285286
}
286287

287288
if (shouldShowValidateCodeForm) {
288289
validateCodeFormRef.current?.clearSignInData();
289-
return;
290+
return true;
290291
}
291292

292293
Navigation.goBack();
294+
return false;
293295
};
294296
useImperativeHandle(ref, () => ({
295297
navigateBack,
296298
}));
299+
useHandleBackButton(navigateBack);
300+
297301
return (
298302
// Bottom SafeAreaView is removed so that login screen svg displays correctly on mobile.
299303
// The SVG should flow under the Home Indicator on iOS.

0 commit comments

Comments
 (0)