import React, { ReactElement } from 'react'; import { StyleSheet } from 'react-native'; import MultiCheckboxIcon from './MultiCheckboxIcon'; import SingleCheckboxIcon from './SingleCheckboxIcon'; import { CheckboxSize, LabelAlign } from './interface'; import createStyle from './styles/checkboxStyle'; import { Checkbox, CheckboxProps } from '../../../core'; import { defaultColor } from '../../../common/colors'; import { useTheme } from '../../Theme'; export interface RNCheckboxProps< ActiveValueT = boolean, InactiveValueT = boolean > extends CheckboxProps { /** * icon 尺寸 * @default 'middle' */ size?: CheckboxSize; /** * labelAlign 对齐方式 * @default 'middle' */ labelAlign?: LabelAlign; } const RNCheckbox = ( props: RNCheckboxProps ) => { const { labelTextStyle, size = 'middle', labelAlign = 'middle', style, activeColor = defaultColor, multiple, prefixIcon, ...restProps } = props; const token = useTheme(); const styles = createStyle(token); const multiRenderIcon: CheckboxProps['renderIcon'] = (renderIconProps) => ( ); const singleRenderIcon: CheckboxProps['renderIcon'] = (renderIconProps) => ( ); return ( ); }; export default React.memo(RNCheckbox) as < ActiveValueT = boolean, InactiveValueT = boolean >( p: RNCheckboxProps ) => ReactElement;