we-insights-react-native
Version:
[we-insights] is a powerful utility library designed to streamline data collection processes for WeApp employees. It simplifies the process of gathering, storing, and managing data within WeApp projects, making it an invaluable tool for enhancing efficien
75 lines • 1.93 kB
JavaScript
import React from 'react';
import CheckmarkSVG from './images/checkmark.svg';
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
export const ContactPermissionCheckbox = ({
isChecked,
onChangeCheck,
style,
translations
}) => {
const handleCheckboxToggle = () => {
onChangeCheck(!isChecked);
};
const {
checkedBorderColor,
uncheckedBorderColor,
checkedBackgroundColor,
uncheckedBackgroundColor,
checkmarkColor,
textColor,
fontFamily
} = style;
const checkboxStyles = {
borderColor: isChecked ? checkedBorderColor : uncheckedBorderColor,
backgroundColor: isChecked ? checkedBackgroundColor : uncheckedBackgroundColor,
...styles.checkbox
};
const checkmarkStyles = {
color: checkmarkColor,
...styles.checkmark
};
const textStyles = {
color: textColor,
fontFamily: fontFamily,
...styles.text
};
return /*#__PURE__*/React.createElement(View, {
style: styles.container
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
onPress: handleCheckboxToggle,
style: styles.checkboxContainer
}, /*#__PURE__*/React.createElement(View, {
style: checkboxStyles
}, isChecked && /*#__PURE__*/React.createElement(Text, {
style: checkmarkStyles
}, /*#__PURE__*/React.createElement(CheckmarkSVG, null)))), /*#__PURE__*/React.createElement(Text, {
style: textStyles
}, translations.answerFurtherQuestions));
};
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 8,
marginBottom: 16
},
checkboxContainer: {
marginRight: 10
},
checkbox: {
width: 20,
height: 20,
borderWidth: 2,
borderRadius: 4,
justifyContent: 'center',
alignItems: 'center'
},
checkmark: {
fontSize: 14
},
text: {
fontSize: 16,
lineHeight: 22
}
});
//# sourceMappingURL=ContactPermissionCheckbox.js.map