UNPKG

elephant-com

Version:

the general component for elephant washing shoes

25 lines (23 loc) 733 B
import React from 'react'; import { TouchableOpacity, Text } from 'react-native'; import { Icon } from 'antd-mobile'; /* eslint-disable no-undef,no-unused-expressions */ export default Radio = ({ onChange, children, checked, size = 14 }) => { const cType = typeof children; const child = cType === 'string' ? <Text>{children}</Text> : children; return ( <TouchableOpacity style={{ flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', }} onPress={() => { onChange && onChange(!checked); }} > <Icon type={checked ? '\ue630' : '\ue631'} size={size} color={checked ? '#00abea' : '#efefef'} /> {child} </TouchableOpacity> ); };