Skip to content

Commit

Permalink
Merge pull request #37002 from bernhardoj/fix/35239-keyboard-shows-wh…
Browse files Browse the repository at this point in the history
…en-open-concierge

Fix keyboard appears briefly when opening concierge page from a chat
  • Loading branch information
marcochavezf authored Feb 28, 2024
2 parents 4178430 + f5a0bd4 commit 7f7f440
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/libs/Navigation/dismissModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function dismissModal(navigationRef: NavigationContainerRef<RootStackParamList>)
case NAVIGATORS.RIGHT_MODAL_NAVIGATOR:
case SCREENS.NOT_FOUND:
case SCREENS.REPORT_ATTACHMENTS:
case SCREENS.CONCIERGE:
navigationRef.dispatch({...StackActions.pop(), target: state.key});
break;
default: {
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/dismissModalWithReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function dismissModalWithReport(targetReport: Report | EmptyObject, navigationRe
case NAVIGATORS.RIGHT_MODAL_NAVIGATOR:
case SCREENS.NOT_FOUND:
case SCREENS.REPORT_ATTACHMENTS:
case SCREENS.CONCIERGE:
// If we are not in the target report, we need to navigate to it after dismissing the modal
if (targetReport.reportID !== getTopmostReportId(state)) {
const reportState = getStateFromPath(ROUTES.REPORT_WITH_ID.getRoute(targetReport.reportID));
Expand Down
8 changes: 1 addition & 7 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ function updateWriteCapabilityAndNavigate(report: Report, newValue: WriteCapabil
/**
* Navigates to the 1:1 report with Concierge
*/
function navigateToConciergeChat(shouldDismissModal = false, shouldPopCurrentScreen = false, checkIfCurrentPageActive = () => true) {
function navigateToConciergeChat(shouldDismissModal = false, checkIfCurrentPageActive = () => true) {
// If conciergeChatReportID contains a concierge report ID, we navigate to the concierge chat using the stored report ID.
// Otherwise, we would find the concierge chat and navigate to it.
if (!conciergeChatReportID) {
Expand All @@ -1731,17 +1731,11 @@ function navigateToConciergeChat(shouldDismissModal = false, shouldPopCurrentScr
if (!checkIfCurrentPageActive()) {
return;
}
if (shouldPopCurrentScreen && !shouldDismissModal) {
Navigation.goBack();
}
navigateToAndOpenReport([CONST.EMAIL.CONCIERGE], shouldDismissModal);
});
} else if (shouldDismissModal) {
Navigation.dismissModal(conciergeChatReportID);
} else {
if (shouldPopCurrentScreen) {
Navigation.goBack();
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(conciergeChatReportID));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ConciergePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function ConciergePage({session}: ConciergePageProps) {
if (isUnmounted.current) {
return;
}
Report.navigateToConciergeChat(undefined, true, () => !isUnmounted.current);
Report.navigateToConciergeChat(true, () => !isUnmounted.current);
});
} else {
Navigation.navigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function PurposeForUsingExpensifyModal() {
}

Report.completeEngagementModal(message, choice);
Report.navigateToConciergeChat(false, true);
Report.navigateToConciergeChat(true);
}, []);

const menuItems: MenuItemProps[] = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function ConnectBankAccount({reimbursementAccount, onBackButtonPress, account, p
const styles = useThemeStyles();
const {translate} = useLocalize();

const handleNavigateToConciergeChat = () => Report.navigateToConciergeChat(false, true);
const handleNavigateToConciergeChat = () => Report.navigateToConciergeChat(true);
const bankAccountState = reimbursementAccount.achData?.state ?? '';

// If a user tries to navigate directly to the validate page we'll show them the EnableStep
Expand Down

0 comments on commit 7f7f440

Please sign in to comment.