mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-25 22:37:18 +10:00
Fix FieldBirthdayInput: valueFromForm prop didn't work anymore
This commit is contained in:
parent
3b463b64be
commit
0509f5224f
2 changed files with 20 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ const FormComponent = props => (
|
|||
name="birthday"
|
||||
label="Date of birth"
|
||||
format={identity}
|
||||
valueFromForm={values.birthDate}
|
||||
valueFromForm={values.birthday}
|
||||
validate={validators.composeValidators(required, minAgeRequired)}
|
||||
/>
|
||||
</form>
|
||||
|
|
@ -52,3 +52,20 @@ export const Empty = {
|
|||
},
|
||||
group: 'custom inputs',
|
||||
};
|
||||
|
||||
export const WithInitialValue = {
|
||||
component: FormComponent,
|
||||
props: {
|
||||
initialValues: { birthday: new Date('1982-03-01') },
|
||||
onChange: formState => {
|
||||
const birthday = formState.values.birthday;
|
||||
if (birthday && formState.dirty) {
|
||||
console.log('birthday changed to:', birthday);
|
||||
}
|
||||
},
|
||||
onSubmit: values => {
|
||||
console.log('BirthdayInput.Form submitted values:', values);
|
||||
},
|
||||
},
|
||||
group: 'custom inputs',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ const FieldBirthdayInputComponent = props => {
|
|||
disabled,
|
||||
input,
|
||||
meta,
|
||||
valueFromForm,
|
||||
} = props;
|
||||
const { valid, invalid, touched, error } = meta;
|
||||
|
||||
|
|
@ -287,6 +288,7 @@ const FieldBirthdayInputComponent = props => {
|
|||
monthLabel,
|
||||
yearLabel,
|
||||
disabled,
|
||||
valueFromForm,
|
||||
...input,
|
||||
};
|
||||
const classes = classNames(rootClassName || css.fieldRoot, className);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue