import React from 'react'; import { View, StyleSheet } from 'react-native'; import MaterialCommunityIcon from '../Icon/MaterialCommunityIcon'; import TouchableHighlight from '../TouchableHighlight/TouchableHighlight'; import { withTheme } from '../../core/theming'; import type { $RemoveChildren, Theme } from '../../types'; import { getAndroidSelectionControlColor } from './utils'; export type Props = $RemoveChildren & { status: 'checked' | 'unchecked' | 'indeterminate'; disabled?: boolean; onPress?: () => void; uncheckedColor?: string; color?: string; theme: Theme; }; const CheckboxAndroid = ({ status, theme, disabled, onPress, ...rest }: Props) => { const checked = status === 'checked'; const indeterminate = status === 'indeterminate'; const { rippleColor, selectionControlColor } = getAndroidSelectionControlColor({ theme, disabled, checked, customColor: rest.color, customUncheckedColor: rest.uncheckedColor, }); const icon = indeterminate ? 'minus-box' : checked ? 'checkbox-marked' : 'checkbox-blank-outline'; return ( ); }; CheckboxAndroid.displayName = 'Checkbox.Android'; const styles = StyleSheet.create({ container: { borderRadius: 18, width: 36, height: 36, padding: 6, }, fillContainer: { alignItems: 'center', justifyContent: 'center', }, fill: { height: 14, width: 14, }, }); export default withTheme(CheckboxAndroid); const CheckboxAndroidWithTheme = withTheme(CheckboxAndroid); export { CheckboxAndroidWithTheme as CheckboxAndroid };