Skip to content

Commit 6d6eca5

Browse files
committed
Fix missing 'id' and 'tabIndex' support for TextInput
1 parent dfeb49c commit 6d6eca5

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,9 @@ function InternalTextInput(props: Props): React.Node {
10791079
'aria-expanded': ariaExpanded,
10801080
'aria-selected': ariaSelected,
10811081
accessibilityState,
1082+
id,
1083+
tabIndex,
1084+
...otherProps
10821085
} = props;
10831086

10841087
const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
@@ -1436,15 +1439,16 @@ function InternalTextInput(props: Props): React.Node {
14361439
textInput = (
14371440
<RCTTextInputView
14381441
ref={_setNativeRef}
1439-
{...props}
1442+
{...otherProps}
14401443
{...eventHandlers}
14411444
accessibilityState={_accessibilityState}
14421445
accessible={accessible}
14431446
submitBehavior={submitBehavior}
14441447
caretHidden={caretHidden}
14451448
dataDetectorTypes={props.dataDetectorTypes}
1446-
focusable={focusable}
1449+
focusable={tabIndex !== undefined ? !tabIndex : focusable}
14471450
mostRecentEventCount={mostRecentEventCount}
1451+
nativeID={id ?? props.nativeID}
14481452
onBlur={_onBlur}
14491453
onKeyPressSync={props.unstable_onKeyPressSync}
14501454
onChange={_onChange}
@@ -1485,7 +1489,7 @@ function InternalTextInput(props: Props): React.Node {
14851489
* fixed */
14861490
<AndroidTextInput
14871491
ref={_setNativeRef}
1488-
{...props}
1492+
{...otherProps}
14891493
{...eventHandlers}
14901494
accessibilityState={_accessibilityState}
14911495
accessibilityLabelledBy={_accessibilityLabelledBy}
@@ -1495,8 +1499,9 @@ function InternalTextInput(props: Props): React.Node {
14951499
caretHidden={caretHidden}
14961500
children={children}
14971501
disableFullscreenUI={props.disableFullscreenUI}
1498-
focusable={focusable}
1502+
focusable={tabIndex !== undefined ? !tabIndex : focusable}
14991503
mostRecentEventCount={mostRecentEventCount}
1504+
nativeID={id ?? props.nativeID}
15001505
numberOfLines={props.rows ?? props.numberOfLines}
15011506
onBlur={_onBlur}
15021507
onChange={_onChange}

Libraries/Components/TextInput/__tests__/TextInput-test.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ describe('TextInput compat with web', () => {
235235
allowFontScaling={true}
236236
focusable={true}
237237
forwardedRef={null}
238-
id="id"
239238
mostRecentEventCount={0}
239+
nativeID="id"
240240
onBlur={[Function]}
241241
onChange={[Function]}
242242
onChangeSync={null}
@@ -254,7 +254,6 @@ describe('TextInput compat with web', () => {
254254
rejectResponderTermination={true}
255255
selection={null}
256256
submitBehavior="blurAndSubmit"
257-
tabIndex={0}
258257
testID="testID"
259258
text=""
260259
underlineColorAndroid="transparent"
@@ -330,18 +329,14 @@ describe('TextInput compat with web', () => {
330329
aria-activedescendant="activedescendant"
331330
aria-atomic={true}
332331
aria-autocomplete="list"
333-
aria-busy={true}
334-
aria-checked={true}
335332
aria-columncount={5}
336333
aria-columnindex={3}
337334
aria-columnspan={2}
338335
aria-controls="controls"
339336
aria-current="current"
340337
aria-describedby="describedby"
341338
aria-details="details"
342-
aria-disabled={true}
343339
aria-errormessage="errormessage"
344-
aria-expanded={true}
345340
aria-flowto="flowto"
346341
aria-haspopup={true}
347342
aria-hidden={true}
@@ -365,7 +360,6 @@ describe('TextInput compat with web', () => {
365360
aria-rowcount={5}
366361
aria-rowindex={3}
367362
aria-rowspan={3}
368-
aria-selected={true}
369363
aria-setsize={5}
370364
aria-sort="ascending"
371365
aria-valuemax={5}

0 commit comments

Comments
 (0)