mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-03 02:42:05 +00:00
committed by
Nicolas Gallagher
parent
a8a0c1763b
commit
213b616b3c
@@ -23,7 +23,7 @@ function findSwitchThumb(container) {
|
|||||||
|
|
||||||
describe('components/Switch', () => {
|
describe('components/Switch', () => {
|
||||||
test('accessibilityLabel is applied to native checkbox', () => {
|
test('accessibilityLabel is applied to native checkbox', () => {
|
||||||
const { container } = render(<Switch accessibilityLabel="switch" />);
|
const { container } = render(<Switch aria-label="switch" />);
|
||||||
expect(findCheckbox(container).getAttribute('aria-label')).toBe('switch');
|
expect(findCheckbox(container).getAttribute('aria-label')).toBe('switch');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -44,6 +44,7 @@ const Switch: React.AbstractComponent<
|
|||||||
React.ElementRef<typeof View>
|
React.ElementRef<typeof View>
|
||||||
> = React.forwardRef((props, forwardedRef) => {
|
> = React.forwardRef((props, forwardedRef) => {
|
||||||
const {
|
const {
|
||||||
|
'aria-label': ariaLabel,
|
||||||
accessibilityLabel,
|
accessibilityLabel,
|
||||||
activeThumbColor,
|
activeThumbColor,
|
||||||
activeTrackColor,
|
activeTrackColor,
|
||||||
@@ -166,7 +167,7 @@ const Switch: React.AbstractComponent<
|
|||||||
];
|
];
|
||||||
|
|
||||||
const nativeControl = createElement('input', {
|
const nativeControl = createElement('input', {
|
||||||
accessibilityLabel,
|
'aria-label': ariaLabel || accessibilityLabel,
|
||||||
checked: value,
|
checked: value,
|
||||||
disabled: disabled,
|
disabled: disabled,
|
||||||
onBlur: handleFocusState,
|
onBlur: handleFocusState,
|
||||||
|
|||||||
Reference in New Issue
Block a user