Merge pull request #1182 from sharetribe/fix-fieldbirthdayinput

Fix FieldBirthdayInput: valueFromForm prop didn't work anymore
This commit is contained in:
Vesa Luusua 2019-08-29 12:55:50 +03:00 committed by GitHub
commit 0ac72e2ff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View file

@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:
## Upcoming version 2019-XX-XX
- [fix] Bug fix: valueFromForm prop wasn't passed through different subcomponents.
[#1182](https://github.com/sharetribe/flex-template-web/pull/1182)
- [add] Update German and French translations.
[#1184](https://github.com/sharetribe/flex-template-web/pull/1184)
- [change] Migrate from `react-helmet` to `react-helmet-async`

View file

@ -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',
};

View file

@ -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);