var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React from 'react'; import { StyleSheet, TouchableOpacity, View, Platform, } from 'react-native'; import TextElement from '../text/Text'; import CheckBoxIcon from './CheckBoxIcon'; import { fonts, withTheme } from '../config'; const CheckBox = (props) => { var _a, _b; const { theme } = props, rest = __rest(props, ["theme"]); const { Component = TouchableOpacity, checked = false, iconRight = false, title, titleProps = {}, center = false, right = false, containerStyle, textStyle, wrapperStyle, onPress, onLongPress, checkedTitle, fontFamily, checkedColor = (_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a.primary } = rest, attributes = __rest(rest, ["Component", "checked", "iconRight", "title", "titleProps", "center", "right", "containerStyle", "textStyle", "wrapperStyle", "onPress", "onLongPress", "checkedTitle", "fontFamily", "checkedColor"]); const accessibilityState = { checked: !!checked, }; return ( {!iconRight && } {React.isValidElement(title) ? title : title !== '' && title && ( {checked ? checkedTitle || title : title} )} {iconRight && } ); }; const styles = StyleSheet.create({ wrapper: { flexDirection: 'row', alignItems: 'center', }, container: { margin: 5, marginLeft: 10, marginRight: 10, padding: 10, }, containerHasTitle: { borderWidth: 1, borderRadius: 3, backgroundColor: '#fafafa', borderColor: '#ededed', }, }); export { CheckBox }; export default withTheme(CheckBox, 'CheckBox');