Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Web - RHP - Going back closes the RHP Instead of navigating to the confirm page #53629

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/pages/settings/Wallet/VerifyAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) {
const [isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible] = useState(true);

const navigateForwardTo = route.params?.forwardTo;
const backTo = route.params?.backTo;

useBeforeRemove(() => setIsValidateCodeActionModalVisible(false));

Expand All @@ -50,8 +51,8 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) {
const closeModal = useCallback(() => {
// Disable modal visibility so the navigation is animated
setIsValidateCodeActionModalVisible(false);
Navigation.goBack();
}, []);
Navigation.goBack(backTo);
FitseTLT marked this conversation as resolved.
Show resolved Hide resolved
}, [backTo]);

// Handle navigation once the user is validated
useEffect(() => {
Expand All @@ -64,9 +65,9 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) {
if (navigateForwardTo) {
Navigation.navigate(navigateForwardTo, CONST.NAVIGATION.TYPE.UP);
} else {
Navigation.goBack();
Navigation.goBack(backTo);
FitseTLT marked this conversation as resolved.
Show resolved Hide resolved
}
}, [isUserValidated, navigateForwardTo]);
}, [isUserValidated, navigateForwardTo, backTo]);

// Once user is validated or the modal is dismissed, we don't want to show empty content.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand All @@ -78,7 +79,7 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) {
>
<HeaderWithBackButton
title={translate('contacts.validateAccount')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={() => Navigation.goBack(backTo)}
/>
<FullScreenLoadingIndicator style={[styles.flex1, styles.pRelative]} />
</ScreenWrapper>
Expand Down
Loading