import React from 'react'; import { StyleSheet, View } from 'react-native'; import { RadioButtonContext, RadioButtonContextType } from './RadioButtonGroup'; import { handlePress, isChecked } from './utils'; import MaterialCommunityIcon from '../Icon/MaterialCommunityIcon'; import TouchableHighlight from '../TouchableHighlight/TouchableHighlight'; import { withTheme } from '../../core/theming'; import type { $RemoveChildren, Theme } from '../../types'; import { getSelectionControlIOSColor } from '../Checkbox/utils'; export type Props = $RemoveChildren & { value: string; status?: 'checked' | 'unchecked'; disabled?: boolean; onPress?: () => void; color?: string; theme: Theme; }; const RadioButtonIOS = ({ disabled, onPress, theme, status, value, ...rest }: Props) => { return ( {(context?: RadioButtonContextType) => { const checked = isChecked({ contextValue: context?.value, status, value, }) === 'checked'; const { checkedColor, rippleColor } = getSelectionControlIOSColor({ theme, disabled, customColor: rest.color, }); return ( { handlePress({ onPress, value, onValueChange: context?.onValueChange, }); } } style={styles.container} > ); }} ); }; RadioButtonIOS.displayName = 'RadioButton.IOS'; const styles = StyleSheet.create({ container: { borderRadius: 18, padding: 6, }, }); export default withTheme(RadioButtonIOS); const RadioButtonIOSWithTheme = withTheme(RadioButtonIOS); export { RadioButtonIOSWithTheme as RadioButtonIOS };