Skip to content

Commit

Permalink
Merge pull request Expensify#51376 from nkdengineer/fix/51145
Browse files Browse the repository at this point in the history
Cannot submit survey after pressing Enter
  • Loading branch information
NikkiWines authored Oct 24, 2024
2 parents 73d7969 + ab2b1ff commit 32d4ddf
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StackScreenProps} from '@react-navigation/stack';
import React, {useCallback, useEffect} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Icon from '@components//Icon';
import Button from '@components/Button';
Expand All @@ -22,20 +22,17 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type {ExitReason, ExitSurveyReasonForm} from '@src/types/form/ExitSurveyReasonForm';
import type {ExitSurveyReasonForm} from '@src/types/form/ExitSurveyReasonForm';
import EXIT_SURVEY_REASON_INPUT_IDS from '@src/types/form/ExitSurveyReasonForm';
import ExitSurveyOffline from './ExitSurveyOffline';

type ExitSurveyConfirmPageOnyxProps = {
exitReason?: ExitReason | null;
};
type ExitSurveyConfirmPageProps = StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM>;

type ExitSurveyConfirmPageProps = ExitSurveyConfirmPageOnyxProps & StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM>;

function ExitSurveyConfirmPage({exitReason, route, navigation}: ExitSurveyConfirmPageProps) {
function ExitSurveyConfirmPage({route, navigation}: ExitSurveyConfirmPageProps) {
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const styles = useThemeStyles();
const [exitReason] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM, {selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[EXIT_SURVEY_REASON_INPUT_IDS.REASON] ?? null});

const getBackToParam = useCallback(() => {
if (isOffline) {
Expand Down Expand Up @@ -82,6 +79,7 @@ function ExitSurveyConfirmPage({exitReason, route, navigation}: ExitSurveyConfir
success
large
text={translate('exitSurvey.goToExpensifyClassic')}
pressOnEnter
onPress={() => {
ExitSurvey.switchToOldDot();
Navigation.dismissModal();
Expand All @@ -96,9 +94,4 @@ function ExitSurveyConfirmPage({exitReason, route, navigation}: ExitSurveyConfir

ExitSurveyConfirmPage.displayName = 'ExitSurveyConfirmPage';

export default withOnyx<ExitSurveyConfirmPageProps, ExitSurveyConfirmPageOnyxProps>({
exitReason: {
key: ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM,
selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[EXIT_SURVEY_REASON_INPUT_IDS.REASON] ?? null,
},
})(ExitSurveyConfirmPage);
export default ExitSurveyConfirmPage;

0 comments on commit 32d4ddf

Please sign in to comment.