Skip to content

Commit c7091e3

Browse files
author
Marik Shnitman
committed
Fixed AccessibilityState
1 parent 2e46199 commit c7091e3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/switch/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ class Switch extends Component<SwitchProps> {
8686
return {
8787
accessible: true,
8888
accessibilityRole: 'switch',
89-
accessibilityState: disabled ? ['disabled'] : value ? ['checked'] : ['unchecked'],
89+
// accessibilityState: disabled ? ['disabled'] : value ? ['checked'] : ['unchecked'],
90+
accessibilityState: {
91+
disabled,
92+
checked: value ? 'checked' : 'unchecked'
93+
},
9094
accessibilityValue: {text: value ? '1' : '0'}
9195
};
9296
}

src/components/switch/switch.driver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const SwitchDriverFactory = ({wrappedComponent, testID}: {wrappedComponen
1111
press: () => fireEvent(switchComp, 'press'),
1212
getAccessibilityValue: () => switchComp.props.accessibilityValue.text === '1',
1313
isDisabled: () => switchComp.props.accessibilityState.disabled === true,
14-
isChecked: () => switchComp.props.accessibilityState['0'] === 'checked',
14+
isChecked: () => switchComp.props.accessibilityState.checked === 'checked',
1515
getColor: () => switchComp.props.style.backgroundColor
1616
};
1717

0 commit comments

Comments
 (0)