Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/libs/actions/ExitSurvey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import Onyx from 'react-native-onyx';
import * as API from '@libs/API';
import {WRITE_COMMANDS} from '@libs/API/types';
import ONYXKEYS from '@src/ONYXKEYS';
import RESPONSE_INPUT_IDS from '@src/types/form/ExitSurveyResponseForm';

function saveResponse(response: string) {
Onyx.set(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM, {[RESPONSE_INPUT_IDS.RESPONSE]: response});
}

/**
* Save the user's response to the mandatory exit survey in the back-end.
Expand Down Expand Up @@ -45,4 +40,4 @@ function resetExitSurveyForm(callback: () => void) {
}).then(callback);
}

export {saveResponse, switchToOldDot, resetExitSurveyForm};
export {switchToOldDot, resetExitSurveyForm};
18 changes: 7 additions & 11 deletions src/pages/settings/ExitSurvey/DynamicExitSurveyReasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {saveResponse} from '@libs/actions/ExitSurvey';
import {switchToOldDot} from '@libs/actions/ExitSurvey';
import {setErrorFields} from '@libs/actions/FormActions';
import {getMicroSecondOnyxErrorWithMessage} from '@libs/ErrorUtils';
import Log from '@libs/Log';
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
import StatusBar from '@libs/StatusBar';
import Navigation from '@navigation/Navigation';
import variables from '@styles/variables';
Expand Down Expand Up @@ -54,11 +53,6 @@ function DynamicExitSurveyReasonPage() {
// When the keyboard is shown, the bottom inset doesn't affect the height, so we take it out from the calculation.
const {top: safeAreaInsetsTop} = useSafeAreaInsets();

const submitForm = useCallback(() => {
saveResponse(draftResponse);
Comment thread
allgandalf marked this conversation as resolved.
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.EXIT_SURVEY_CONFIRM.path), {forceReplace: true});
}, [draftResponse]);

const goBackJustOnce = useCallback(() => {
Log.info('[ExitSurvey] User chose Go back just once');
Navigation.dismissModal();
Expand All @@ -79,9 +73,11 @@ function DynamicExitSurveyReasonPage() {
});
return;
}
submitForm();
}, [draftResponse, submitForm, translate]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, switchToClassic);
switchToOldDot(draftResponse);
Navigation.dismissModal();
openOldDotLink(CONST.OLDDOT_URLS.INBOX, true);
Comment thread
allgandalf marked this conversation as resolved.
}, [draftResponse, translate]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, switchToClassic, {isActive: !isOffline});

const formTopMarginsStyle = styles.mt3;
const baseResponseInputContainerStyle = styles.mt3;
Expand All @@ -107,7 +103,7 @@ function DynamicExitSurveyReasonPage() {
<FormProvider
formID={ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM}
style={[styles.flex1, styles.mh5, formTopMarginsStyle, StyleUtils.getMaximumHeight(formMaxHeight)]}
onSubmit={submitForm}
onSubmit={switchToClassic}
submitButtonText=""
isSubmitButtonVisible={false}
shouldValidateOnBlur={false}
Expand Down
Loading