import React , { FunctionComponent } from 'react' ; import { UseField } from '../../form' ; import { DescribedFormRow , Props as DescribedFormRowProps , SwitchProps , } from './described_form_row' ; type Props = Omit < DescribedFormRowProps , 'switchProps' > & { switchProps : Omit < SwitchProps , 'label' > & { path : string ; } ; } ; export const ToggleFieldWithDescribedFormRow = ( { switchProps , ... passThroughProps } ) => ( < UseField < boolean > path = { switchProps . path } > { ( field ) => { return ( < DescribedFormRow { ... passThroughProps } switchProps = { { ... switchProps , label : field . label , checked : field . value , onChange : field . setValue , } } />); } } < /UseField>);