Browse Source

Fix flow error

master
meriadec 7 years ago
parent
commit
bf977c4439
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 5
      src/components/base/CheckBox/index.js
  2. 5
      src/components/base/Radio/index.js

5
src/components/base/CheckBox/index.js

@ -1,7 +1,6 @@
// @flow
import React from 'react'
import noop from 'lodash/noop'
import styled, { keyframes } from 'styled-components'
import { Tabbable } from 'components/base/Box'
@ -54,14 +53,14 @@ type Props = {
function CheckBox(props: Props) {
const { isChecked, onChange, ...p } = props
return (
<Base isChecked={isChecked} onClick={() => onChange(!isChecked)} {...p}>
<Base isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} {...p}>
{isChecked && <IconWrapper name="check" />}
</Base>
)
}
CheckBox.defaultProps = {
onChange: noop,
onChange: null,
}
export default CheckBox

5
src/components/base/Radio/index.js

@ -1,7 +1,6 @@
// @flow
import React from 'react'
import noop from 'lodash/noop'
import styled from 'styled-components'
import { Tabbable } from 'components/base/Box'
@ -63,11 +62,11 @@ type Props = {
function Radio(props: Props) {
const { isChecked, onChange } = props
return <Base {...props} isChecked={isChecked} onClick={() => onChange(!isChecked)} />
return <Base {...props} isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} />
}
Radio.defaultProps = {
onChange: noop,
onChange: null,
}
export default Radio

Loading…
Cancel
Save