Skip to content

Commit

Permalink
feat(exoflex): supports a11y for checkbox (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
oshimayoan authored Apr 27, 2020
1 parent 4c44105 commit 66809af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/exoflex/src/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
TouchableOpacity,
View,
ViewStyle,
AccessibilityProps,
} from 'react-native';
import Text from './Text';
import { DefaultTheme } from '../constants/themes';
import useTheme from '../helpers/useTheme';
import Check from './svg/Check';

export type CheckboxProps = {
export type CheckboxProps = AccessibilityProps & {
/**
* The text/string for the checkbox
*/
Expand Down Expand Up @@ -62,11 +63,17 @@ export default function Checkbox(props: CheckboxProps) {
textStyle,
style,
testID,
accessibilityRole,
accessibilityState,
...otherAccessibilityProps
} = props;
let { colors, roundness, style: themeStyle } = useTheme();

return (
<TouchableOpacity
{...otherAccessibilityProps}
accessibilityRole={accessibilityRole || 'checkbox'}
accessibilityState={{ checked, disabled, ...accessibilityState }}
style={[styles.container, style]}
onPress={() => onPress(!checked)}
disabled={disabled}
Expand Down

0 comments on commit 66809af

Please sign in to comment.