import React from 'react'; import { SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, Image, TouchableOpacity, View, ViewStyle, } from 'react-native'; import { colors, px2dp } from '../../utils'; interface Props { checked: boolean onChange?: Function disable?: boolean containerStyle?: ViewStyle type?: 'radio' | 'checkBox' } interface State { } export default class KitCheckBox extends React.Component { constructor(props: Props) { super(props); }; public readonly state: Readonly = { }; onPress() { const { onChange, checked } = this.props; onChange && onChange(!checked) }; render() { const { checked, disable = false, containerStyle, type = 'radio' } = this.props; return ( <> { type === 'radio' ? { checked ? : } : { checked ? : } } ) } } const styles = StyleSheet.create({ checkedBoxContainer: { height: '100%', justifyContent: 'center', alignItems: 'center' }, checkedIcon: { width: px2dp(22), height: px2dp(22), tintColor: colors.greenColor }, container: { width: px2dp(22), height: px2dp(22), borderRadius: px2dp(12), borderWidth: 1, borderColor: '#e2e2e2', backgroundColor: '#f8f8f8', justifyContent: 'center', alignItems: 'center' }, checkedContainer: { borderColor: colors.themeColor, backgroundColor: '#fff' }, checkedBoxInner: { width: px2dp(14), height: px2dp(14), backgroundColor: colors.themeColor, borderRadius: px2dp(7) } });