sgcart/app/components/checkBox/checkBox.tsx
2026-07-03 13:10:46 +05:30

30 lines
744 B
TypeScript

import React from 'react';
import { TouchableOpacity, View, Text } from 'react-native';
import { CheckBoxProps } from './checkBox.props';
import { styles } from './checkBox.styles';
export function CheckBox({
value,
onValueChange,
label,
containerStyle,
labelStyle,
}: CheckBoxProps) {
const handlePress = () => {
onValueChange(!value);
};
return (
<TouchableOpacity
activeOpacity={0.7}
style={[styles.container, containerStyle]}
onPress={handlePress}
>
<View style={[styles.box, value && styles.boxSelected]}>
{value && <Text style={styles.checkmark}></Text>}
</View>
{label && <Text style={[styles.label, labelStyle]}>{label}</Text>}
</TouchableOpacity>
);
}