Skip to content
5 changes: 4 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ const ROUTES = {
getRoute: (backTo?: string) => getUrlWithBackToParam(`troubleshoot/console`, backTo),
},
SETTINGS: 'settings',
SETTINGS_PROFILE: 'settings/profile',
SETTINGS_PROFILE: {
route: 'settings/profile',
getRoute: (backTo?: string) => getUrlWithBackToParam('settings/profile', backTo),
},
SETTINGS_CHANGE_CURRENCY: 'settings/add-payment-card/change-currency',
SETTINGS_SHARE_CODE: 'settings/shareCode',
SETTINGS_DISPLAY_NAME: 'settings/profile/display-name',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ const translations = {
help: 'Help',
expenseReports: 'Expense Reports',
rateOutOfPolicy: 'Rate out of policy',
editYourProfile: 'Edit your profile',
comments: 'Comments',
},
supportalNoAccess: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ const translations = {
help: 'Ayuda',
expenseReports: 'Informes de Gastos',
rateOutOfPolicy: 'Tasa fuera de póliza',
editYourProfile: 'Edita tu perfil',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twilight2294 Please add the discussion here where you confirmed this Spanish translation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, I am yet to be added on slack, can you please ask on my behalf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments: 'Comentarios',
},
supportalNoAccess: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const useRootNavigatorScreenOptions = () => {
splitNavigator: {
...commonScreenOptions,
// We need to turn off animation for the full screen to avoid delay when closing screens.
animation: Animations.NONE,
animation: shouldUseNarrowLayout ? Animations.SLIDE_FROM_RIGHT : Animations.NONE,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably a mistake from this change: https://github.com/Expensify/App/pull/49539/files#diff-f297429dfc1c5cbc87c505542adb66e8df0bd3e39ff6cfb2d78ca699f3d23c84R85

We used to have animation before but when we fixed it for full screen layout here:
https://github.com/Expensify/App/pull/49539/files#diff-f297429dfc1c5cbc87c505542adb66e8df0bd3e39ff6cfb2d78ca699f3d23c84R95-R96

We also updated it for split navigator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not a mistake, this change now pushes the Account profile page into the view on phone, that is not animation we want for bottom tabs

web: {
cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}),
cardStyle: StyleUtils.getNavigationModalCardStyle(),
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
exact: true,
},
[SCREENS.SETTINGS.PROFILE.ROOT]: {
path: ROUTES.SETTINGS_PROFILE,
path: ROUTES.SETTINGS_PROFILE.route,
exact: true,
},
[SCREENS.SETTINGS.SECURITY]: {
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ type SettingsNavigatorParamList = {
tagName: string;
backTo?: Routes;
};
[SCREENS.SETTINGS.PROFILE.ROOT]: {backTo?: Routes};
[SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: {backTo?: Routes};
[SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: {
canChangeSize: 0 | 1;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4874,7 +4874,7 @@ function navigateToDetailsPage(report: OnyxEntry<Report>, backTo?: string) {
const participantAccountID = getParticipantsAccountIDsForDisplay(report);

if (isSelfDMReport || isOneOnOneChatReport) {
Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountID.at(0), backTo));
Navigation.navigate(ROUTES.PROFILE.getRoute(participantAccountID.at(0), isSelfDMReport ? Navigation.getActiveRoute() : backTo));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a bug that if the user refreshes on the settings screen and tries to go back then , then he was directed to the profile details page but was not able to go back further as the navigation state was flushed, fixed that with this change

return;
}

Expand Down
8 changes: 8 additions & 0 deletions src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ function ProfilePage({route}: ProfilePageProps) {
) : null}
{shouldShowLocalTime && <AutoUpdateTime timezone={timezone} />}
</View>
{isCurrentUser && (
<MenuItem
shouldShowRightIcon
title={translate('common.editYourProfile')}
icon={Expensicons.Pencil}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PROFILE.getRoute(Navigation.getActiveRoute()))}
/>
)}
{shouldShowNotificationPreference && (
<MenuItemWithTopDescription
shouldShowRightIcon
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
icon: Expensicons.Profile,
screenName: SCREENS.SETTINGS.PROFILE.ROOT,
brickRoadIndicator: profileBrickRoadIndicator,
action: () => Navigation.navigate(ROUTES.SETTINGS_PROFILE),
action: () => Navigation.navigate(ROUTES.SETTINGS_PROFILE.getRoute()),
},
{
translationKey: 'common.wallet',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function NewContactMethodPage({route, navigation}: NewContactMethodPageProps) {
const validateLoginError = getLatestErrorField(loginData, 'addedLogin');
const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.validated});

const navigateBackTo = route?.params?.backTo ?? ROUTES.SETTINGS_PROFILE;
const navigateBackTo = route?.params?.backTo ?? ROUTES.SETTINGS_PROFILE.getRoute();

const hasFailedToSendVerificationCode = !!pendingContactAction?.errorFields?.actionVerified;

Expand Down Expand Up @@ -121,7 +121,7 @@ function NewContactMethodPage({route, navigation}: NewContactMethodPageProps) {
);

const onBackButtonPress = useCallback(() => {
if (navigateBackTo === ROUTES.SETTINGS_PROFILE) {
if (navigateBackTo === ROUTES.SETTINGS_PROFILE.getRoute()) {
Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.route);
return;
}
Expand Down
8 changes: 6 additions & 2 deletions src/pages/settings/Profile/ProfilePage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useRoute} from '@react-navigation/native';
import React, {useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
Expand All @@ -24,13 +25,16 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {formatPhoneNumber} from '@libs/LocalePhoneNumber';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
import {getFormattedAddress} from '@libs/PersonalDetailsUtils';
import {getFullSizeAvatar, getLoginListBrickRoadIndicator, isDefaultAvatar} from '@libs/UserUtils';
import {clearAvatarErrors, deleteAvatar, updateAvatar} from '@userActions/PersonalDetails';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

function ProfilePage() {
Expand All @@ -44,7 +48,7 @@ function ProfilePage() {
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST);
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();

const route = useRoute<PlatformStackRouteProp<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.PROFILE.ROOT>>();
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);

const getPronouns = (): string => {
Expand Down Expand Up @@ -148,7 +152,7 @@ function ProfilePage() {
>
<HeaderWithBackButton
title={translate('common.profile')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={() => Navigation.goBack(route.params?.backTo)}
shouldShowBackButton={shouldUseNarrowLayout}
shouldDisplaySearchRouter
icon={Illustrations.Profile}
Expand Down
2 changes: 1 addition & 1 deletion tests/navigation/NavigateTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Navigate', () => {

// When navigate to the page from the same split navigator
act(() => {
Navigation.navigate(ROUTES.SETTINGS_PROFILE);
Navigation.navigate(ROUTES.SETTINGS_PROFILE.getRoute());
});

// Then push a new page to the current split navigator
Expand Down