Skip to content

Commit 11e2e5e

Browse files
authored
Merge pull request #58452 from daledah/fix/57342
2 parents b0e25f7 + fe44a74 commit 11e2e5e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/libs/Navigation/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,8 @@ type SettingsNavigatorParamList = {
804804
[SCREENS.SETTINGS.DELEGATE.UPDATE_DELEGATE_ROLE]: {
805805
login: string;
806806
currentRole: string;
807+
showValidateActionModal?: string;
808+
newRole?: ValueOf<typeof CONST.DELEGATE_ROLE>;
807809
};
808810
[SCREENS.SETTINGS.DELEGATE.DELEGATE_CONFIRM]: {
809811
login: string;

src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateMagicCodeModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function UpdateDelegateMagicCodeModal({login, role, isValidateCodeActionModalVis
2929
}
3030

3131
// Dismiss modal on successful magic code verification
32-
Navigation.navigate(ROUTES.SETTINGS_SECURITY);
32+
Navigation.goBack(ROUTES.SETTINGS_SECURITY);
3333
}, [login, currentDelegate, role, updateDelegateErrors]);
3434

3535
const onBackButtonPress = () => {

src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useEffect, useState} from 'react';
22
import type {ValueOf} from 'type-fest';
33
import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
4+
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
45
import HeaderWithBackButton from '@components/HeaderWithBackButton';
56
import ScreenWrapper from '@components/ScreenWrapper';
67
import SelectionList from '@components/SelectionList';
@@ -25,8 +26,15 @@ function UpdateDelegateRolePage({route}: UpdateDelegateRolePageProps) {
2526
const {translate} = useLocalize();
2627
const login = route.params.login;
2728
const currentRole = route.params.currentRole;
28-
const [isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible] = useState(false);
29-
const [newRole, setNewRole] = useState<ValueOf<typeof CONST.DELEGATE_ROLE> | null>();
29+
const showValidateActionModalFromURL = route.params.showValidateActionModal === 'true';
30+
const newRoleFromURL = route.params.newRole;
31+
const [isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible] = useState(showValidateActionModalFromURL ?? false);
32+
const [newRole, setNewRole] = useState<ValueOf<typeof CONST.DELEGATE_ROLE> | undefined>(newRoleFromURL);
33+
const [shouldShowLoading, setShouldShowLoading] = useState(showValidateActionModalFromURL ?? false);
34+
35+
useEffect(() => {
36+
Navigation.setParams({showValidateActionModal: isValidateCodeActionModalVisible, newRole});
37+
}, [isValidateCodeActionModalVisible, newRole]);
3038

3139
const styles = useThemeStyles();
3240
const roleOptions = Object.values(CONST.DELEGATE_ROLE).map((role) => ({
@@ -89,11 +97,13 @@ function UpdateDelegateRolePage({route}: UpdateDelegateRolePageProps) {
8997
role={newRole}
9098
isValidateCodeActionModalVisible={isValidateCodeActionModalVisible}
9199
onClose={() => {
100+
setShouldShowLoading(false);
92101
setIsValidateCodeActionModalVisible(false);
93102
}}
94103
/>
95104
)}
96105
</DelegateNoAccessWrapper>
106+
{shouldShowLoading && <FullScreenLoadingIndicator />}
97107
</ScreenWrapper>
98108
);
99109
}

0 commit comments

Comments
 (0)