forked from cemaden-educacao/WPD-MobileApp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
944 B
39 lines
944 B
import React from 'react';
|
|
import { Pressable, StyleSheet, View, } from 'react-native';
|
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
import colors from "../config/colors";
|
|
|
|
export default function CustomCheckBox({value, onValueChange, ...otherProps}) {
|
|
const onCheckmarkPress = () => {
|
|
onValueChange(!value);
|
|
}
|
|
|
|
return (
|
|
<View style={otherProps.style}>
|
|
<Pressable
|
|
style={[styles.checkboxBase, value && styles.checkboxChecked]}
|
|
onPress={onCheckmarkPress}>
|
|
{value && <MaterialCommunityIcons name="check" size={15} color="white" />}
|
|
</Pressable>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
checkboxBase: {
|
|
width: 20,
|
|
height: 20,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
borderRadius: 4,
|
|
borderWidth: 2,
|
|
borderColor: colors.primary,
|
|
backgroundColor: 'transparent',
|
|
},
|
|
checkboxChecked: {
|
|
backgroundColor: colors.primary,
|
|
},
|
|
|
|
|
|
});
|