mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Improve checkbox value resolveing
Add better props validation and value resolving for FieldCheckbox.
This commit is contained in:
parent
6fb43f4aaf
commit
8cbe50aed4
1 changed files with 3 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { node, string, object } from 'prop-types';
|
||||
import { any, node, string, object, shape } from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { Field } from 'redux-form';
|
||||
import { ValidationError } from '../../components';
|
||||
|
|
@ -40,7 +40,7 @@ const FieldCheckboxComponent = props => {
|
|||
const classes = classNames(rootClassName || css.root, className);
|
||||
|
||||
const { value, ...inputProps } = input;
|
||||
const checked = !!value;
|
||||
const checked = value === true;
|
||||
|
||||
const checkboxProps = {
|
||||
id,
|
||||
|
|
@ -80,7 +80,7 @@ FieldCheckboxComponent.propTypes = {
|
|||
label: node,
|
||||
|
||||
// redux-form Field params
|
||||
input: object.isRequired,
|
||||
input: shape({ value: any }).isRequired,
|
||||
meta: object.isRequired,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue