Skip to content

Commit

Permalink
Merge pull request #43328 from bernhardoj/fix/43069-subscription-size…
Browse files Browse the repository at this point in the history
…-not-trimmed

Fix subscription size value not trim able to add spaces before the value
  • Loading branch information
tylerkaraszewski authored Jun 13, 2024
2 parents 6c3f605 + aa9b1e4 commit f9a86bc
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Text from '@components/Text';
import TextInput from '@components/TextInput';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import useStepFormSubmit from '@hooks/useStepFormSubmit';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import {validate} from '@pages/settings/Subscription/SubscriptionSize/utils';
Expand All @@ -20,6 +21,13 @@ function Size({onNext}: SizeProps) {
const styles = useThemeStyles();
const {inputCallbackRef} = useAutoFocusInput();

const handleSubmit = useStepFormSubmit<typeof ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM>({
formId: ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM,
fieldIds: [INPUT_IDS.SUBSCRIPTION_SIZE],
onNext,
shouldSaveDraft: true,
});

const defaultValues = {
// TODO this is temporary and default value will be replaced in next phase once data in ONYX is ready
[INPUT_IDS.SUBSCRIPTION_SIZE]: '',
Expand All @@ -29,7 +37,7 @@ function Size({onNext}: SizeProps) {
<FormProvider
formID={ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM}
submitButtonText={translate('common.next')}
onSubmit={onNext}
onSubmit={handleSubmit}
validate={validate}
style={[styles.mh5, styles.flexGrow1]}
>
Expand Down

0 comments on commit f9a86bc

Please sign in to comment.