Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subscription size value not trim able to add spaces before the value #43328

Merged
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
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
Loading