From 6b80a15cb8fe3ce3cdb6eff09b7086df8df8c8c2 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 14 Mar 2024 12:00:36 -0600 Subject: [PATCH] Merge pull request #38308 from abzokhattab/fix-contact-method-back-navigation [CP Staging] Fix contact method back navigation (cherry picked from commit ac2d14d921357c22ee70fc0408f19a8fa3d39f5a) --- src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx index 80b76b9a6acb..cbb1f5991ad3 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx @@ -38,7 +38,7 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps const styles = useThemeStyles(); const {formatPhoneNumber, translate} = useLocalize(); const loginNames = Object.keys(loginList ?? {}); - const navigateBackTo = route?.params?.backTo || ROUTES.SETTINGS_PROFILE; + const navigateBackTo = route?.params?.backTo; // Sort the login names by placing the one corresponding to the default contact method as the first item before displaying the contact methods. // The default contact method is determined by checking against the session email (the current login). @@ -91,10 +91,6 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps }); const onNewContactMethodButtonPress = useCallback(() => { - if (navigateBackTo === ROUTES.SETTINGS_PROFILE) { - Navigation.navigate(ROUTES.SETTINGS_NEW_CONTACT_METHOD.route); - return; - } Navigation.navigate(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo)); }, [navigateBackTo]);