Skip to content

feat(input): add textInputRef to reach the TextInput - #1927

Open
bataevvlad wants to merge 1 commit into
masterfrom
feat/input-text-input-ref
Open

bataevvlad wants to merge 1 commit into
masterfrom
feat/input-text-input-ref

Conversation

@bataevvlad

@bataevvlad bataevvlad commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Input's ref is the InputRef API (focus / blur / isFocused / clear), so a library that expects a React Native TextInput (setNativeProps, measure, react-phone-number-input's inputComponent) cannot use it. Same for Autocomplete.

Fix

  • Input gains textInputRef?: React.Ref<TextInput>, forwarded to the underlying TextInput through a callback ref that also feeds the internal ref, so the InputRef API keeps working alongside it. Object and callback refs are both supported.
  • Autocomplete extends InputProps and spreads them onto its Input, so textInputRef reaches the native input; documented on both components.
  • Showcase InputNativeRef (end of SHOWCASES): an Input and an Autocomplete with native refs; the probe button reports both ref types and calls setNativeProps({ text }) on the Input's node. Docs rows in input.mdx and autocomplete.mdx. No story: nothing visual.

Verification

  • Specs (3 new, all fail on master): input.spec.tsx object ref and callback ref receive the TextInput instance while InputRef still works; autocomplete.spec.tsx textInputRef receives the TextInput.
  • Android emulator (Pixel 7, Eva light, section-InputNativeRef): pressing the probe shows "native refs: input TextInput, autocomplete TextInput" and the Input's text becomes "set through setNativeProps".
  • iOS simulator and yarn e2e:ios: see "iOS verification (2026-09-28)" below.
  • Gates: yarn turbo run build --filter=@ui-kitten/components, yarn typecheck:all, yarn lint (0 errors, 50 pre-existing warnings), yarn test --runInBand (74 suites, 1889 tests) pass.

Changeset: @ui-kitten/components minor.

Closes #1520

iOS verification (2026-09-28)

iPhone 17 simulator (iOS 26.2), debug build on Metro from a clean worktree of this branch, driven with agent-device.

  • section-InputNativeRef: the probe reports native refs: input TextInput, autocomplete TextInput and the Input shows set through setNativeProps.
  • Old Input section: typing still works; old Autocomplete section: typing st shows Star Wars / Interstellar, picking Star Wars fills the field.
  • yarn e2e:ios against a Metro serving this branch (the flags injected into a scratch copy of the scripts; without them agent-device test loads the bundle from :8081): smoke.ad and icon-touchable.ad pass; modal-nested.ad (step 51) and autocomplete.ad fail exactly as on master (both fixed in test(e2e): keep modals inside the snapshot budget #1918). An earlier run reported here had loaded another checkout's bundle from :8081 and did not test this branch.

Android verification (2026-09-28, second pass)

Pixel 7 emulator (API 34), debug build on Metro from a clean worktree of this branch, driven with agent-device.

  • section-InputNativeRef: probe -> native refs: input TextInput, autocomplete TextInput, Input text set through setNativeProps; the Autocomplete with textInputRef filters on typing.
  • Old Input typing and old Autocomplete (fill st -> Star Wars / Interstellar, pick Star Wars) work. A plain tap on an Autocomplete opens the list without the keyboard (keyboard on the second tap): identical on master, pre-existing.
  • popover-android.ad is stale on master (its fixed scroll count stops at the List section) and was not a branch check; test(e2e): reach showcase sections through a deep link #1932 replaces the scrolls with a section deep link. The Android replay line previously reported here had also loaded another checkout's bundle from :8081.

The component ref is the InputRef API, so libraries that expect a React
Native TextInput (setNativeProps, measure) could not use Input.
`textInputRef` forwards the native node; Autocomplete passes it through.
Closes #1520.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use forwardRef to underlying RN components

1 participant