Skip to content

Commit a2bce5b

Browse files
authored
Merge pull request #64674 from nkdengineer/fix/63919
Test drive modal appears briefly when closing the validation page
2 parents b8ef627 + 875bd5b commit a2bce5b

4 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/components/FeatureTrainingModal.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ type BaseFeatureTrainingModalProps = {
127127

128128
/** Whether to navigate back when closing the modal */
129129
shouldGoBack?: boolean;
130+
131+
/** Whether to call onHelp when modal is hidden completely */
132+
shouldCallOnHelpWhenModalHidden?: boolean;
130133
};
131134

132135
type FeatureTrainingModalVideoProps = {
@@ -192,6 +195,7 @@ function FeatureTrainingModal({
192195
shouldShowConfirmationLoader = false,
193196
canConfirmWhileOffline = true,
194197
shouldGoBack = true,
198+
shouldCallOnHelpWhenModalHidden = false,
195199
}: FeatureTrainingModalProps) {
196200
const styles = useThemeStyles();
197201
const StyleUtils = useStyleUtils();
@@ -372,6 +376,12 @@ function FeatureTrainingModal({
372376
: {}),
373377
...modalInnerContainerStyle,
374378
}}
379+
onModalHide={() => {
380+
if (!shouldCallOnHelpWhenModalHidden) {
381+
return;
382+
}
383+
onHelp();
384+
}}
375385
>
376386
<Wrapper
377387
style={[styles.mh100, onboardingIsMediumOrLargerScreenWidth && StyleUtils.getWidthStyle(width)]}
@@ -405,7 +415,13 @@ function FeatureTrainingModal({
405415
<Button
406416
large
407417
style={[styles.mb3]}
408-
onPress={onHelp}
418+
onPress={() => {
419+
if (shouldCallOnHelpWhenModalHidden) {
420+
setIsModalVisible(false);
421+
return;
422+
}
423+
onHelp();
424+
}}
409425
text={helpText}
410426
/>
411427
)}

src/components/TestDrive/Modal/AdminTestDriveModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function AdminTestDriveModal() {
3535
description={translate('testDrive.modal.description')}
3636
onConfirm={navigate}
3737
onHelp={skipTestDrive}
38+
shouldCallOnHelpWhenModalHidden
3839
/>
3940
);
4041
}

src/components/TestDrive/Modal/BaseTestDriveModal.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ import CONST from '@src/CONST';
99

1010
type BaseTestDriveModalProps = Pick<
1111
FeatureTrainingModalProps,
12-
'children' | 'description' | 'onConfirm' | 'shouldCloseOnConfirm' | 'shouldRenderHTMLDescription' | 'avoidKeyboard' | 'shouldShowConfirmationLoader' | 'canConfirmWhileOffline' | 'onHelp'
12+
| 'children'
13+
| 'description'
14+
| 'onConfirm'
15+
| 'shouldCloseOnConfirm'
16+
| 'shouldRenderHTMLDescription'
17+
| 'avoidKeyboard'
18+
| 'shouldShowConfirmationLoader'
19+
| 'canConfirmWhileOffline'
20+
| 'onHelp'
21+
| 'shouldCallOnHelpWhenModalHidden'
1322
>;
1423

1524
function BaseTestDriveModal({
@@ -22,6 +31,7 @@ function BaseTestDriveModal({
2231
avoidKeyboard,
2332
shouldShowConfirmationLoader,
2433
canConfirmWhileOffline,
34+
shouldCallOnHelpWhenModalHidden,
2535
}: BaseTestDriveModalProps) {
2636
const styles = useThemeStyles();
2737
const {translate} = useLocalize();
@@ -46,6 +56,7 @@ function BaseTestDriveModal({
4656
shouldShowConfirmationLoader={shouldShowConfirmationLoader}
4757
shouldUseScrollView
4858
canConfirmWhileOffline={canConfirmWhileOffline}
59+
shouldCallOnHelpWhenModalHidden={shouldCallOnHelpWhenModalHidden}
4960
>
5061
{children}
5162
</FeatureTrainingModal>

src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function EmployeeTestDriveModal() {
109109
avoidKeyboard
110110
shouldShowConfirmationLoader={isLoading}
111111
canConfirmWhileOffline={false}
112+
shouldCallOnHelpWhenModalHidden
112113
>
113114
<TextInput
114115
placeholder={translate('testDrive.modal.employee.email')}

0 commit comments

Comments
 (0)