fix(widgets): fix list object field default values (#1826)

This commit is contained in:
Bartholomew
2018-11-02 15:55:08 +01:00
committed by Shawn Erquhart
parent a9f69f9ddc
commit c765793971
3 changed files with 32 additions and 9 deletions

View File

@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import styled from 'react-emotion';
import { isBoolean } from 'lodash';
import { Toggle, ToggleBackground, colors } from 'netlify-cms-ui-default';
const BooleanBackground = styled(ToggleBackground)`
@ -13,7 +12,6 @@ export default class BooleanControl extends React.Component {
render() {
const {
value,
field,
forID,
onChange,
classNameWrapper,
@ -24,7 +22,7 @@ export default class BooleanControl extends React.Component {
<div className={classNameWrapper}>
<Toggle
id={forID}
active={isBoolean(value) ? value : field.get('defaultValue', false)}
active={value}
onChange={onChange}
onFocus={setActiveStyle}
onBlur={setInactiveStyle}