Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
// so omitting onBlur and onFocus pressability handlers here.
const {onBlur, onFocus, ...eventHandlers} = usePressability(config);

const _accessibilityLabel =
props?.['aria-label'] ?? props?.accessibilityLabel;

let _accessibilityState;
if (
accessibilityState != null ||
Expand Down Expand Up @@ -681,6 +684,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
{...otherProps}
{...eventHandlers}
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
accessibilityLabel={_accessibilityLabel}
accessibilityState={_accessibilityState}
accessible={accessible}
submitBehavior={submitBehavior}
Expand Down Expand Up @@ -744,8 +748,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
{...otherProps}
{...colorProps}
{...eventHandlers}
accessibilityState={_accessibilityState}
accessibilityLabel={_accessibilityLabel}
accessibilityLabelledBy={_accessibilityLabelledBy}
accessibilityState={_accessibilityState}
accessible={accessible}
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
autoCapitalize={autoCapitalize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ jest.unmock('../TextInput');

expect(instance.toJSON()).toMatchInlineSnapshot(`
<RCTSinglelineTextInputView
accessibilityLabel="label"
accessibilityState={
Object {
"busy": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,19 @@ const examples: Array<RNTesterModuleExample> = [
return <ToggleDefaultPaddingExample />;
},
},
{
title: 'Accessibility',
render: function (): React.Node {
return (
<View>
<Text>accessibilityLabel prop</Text>
<ExampleTextInput accessibilityLabel="This is Accessibility Label" />
<Text>aria-label prop</Text>
<ExampleTextInput aria-label="This is Aria Label" />
</View>
);
},
},
];

module.exports = ({
Expand Down
15 changes: 15 additions & 0 deletions packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,21 @@ const textInputExamples: Array<RNTesterModuleExample> = [
);
},
},
{
title: 'Accessibility',
render: function (): React.Node {
return (
<View>
<WithLabel label="accessibilityLabel">
<ExampleTextInput accessibilityLabel="This is Accessibility Label" />
</WithLabel>
<WithLabel label="aria-label">
<ExampleTextInput aria-label="This is Aria Label" />
</WithLabel>
</View>
);
},
},
];

module.exports = ({
Expand Down