Skip to content

Commit f9eef24

Browse files
committed
Reusable function for hiding the maintenance modal
1 parent 99ca377 commit f9eef24

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/BookTravelButton.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function BookTravelButton({text}: BookTravelButtonProps) {
5050
// e.g., when the user selects "Trips" from the Expensify Classic menu in HybridApp.
5151
const [wasNewDotLaunchedJustForTravel] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY);
5252

53+
const hideMaintenanceModal = () => setMaintenanceModalVisibility(false);
54+
5355
const bookATrip = useCallback(() => {
5456
setErrorMessage('');
5557

@@ -130,8 +132,8 @@ function BookTravelButton({text}: BookTravelButtonProps) {
130132
/>
131133
<ConfirmModal
132134
title={translate('travel.maintenance.title')}
133-
onConfirm={() => setMaintenanceModalVisibility(false)}
134-
onCancel={() => setMaintenanceModalVisibility(false)}
135+
onConfirm={hideMaintenanceModal}
136+
onCancel={hideMaintenanceModal}
135137
isVisible={isMaintenanceModalVisible}
136138
prompt={translate('travel.maintenance.message')}
137139
confirmText={translate('common.buttonConfirm')}

0 commit comments

Comments
 (0)