feat(input): add textInputRef to reach the TextInput - #1927
Open
bataevvlad wants to merge 1 commit into
Open
bataevvlad wants to merge 1 commit into
bataevvlad wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Input's ref is theInputRefAPI (focus/blur/isFocused/clear), so a library that expects a React NativeTextInput(setNativeProps,measure,react-phone-number-input'sinputComponent) cannot use it. Same forAutocomplete.Fix
InputgainstextInputRef?: React.Ref<TextInput>, forwarded to the underlyingTextInputthrough a callback ref that also feeds the internal ref, so theInputRefAPI keeps working alongside it. Object and callback refs are both supported.AutocompleteextendsInputPropsand spreads them onto itsInput, sotextInputRefreaches the native input; documented on both components.InputNativeRef(end ofSHOWCASES): anInputand anAutocompletewith native refs; the probe button reports both ref types and callssetNativeProps({ text })on the Input's node. Docs rows ininput.mdxandautocomplete.mdx. No story: nothing visual.Verification
input.spec.tsxobject ref and callback ref receive theTextInputinstance whileInputRefstill works;autocomplete.spec.tsxtextInputRefreceives theTextInput.section-InputNativeRef): pressing the probe shows "native refs: input TextInput, autocomplete TextInput" and the Input's text becomes "set through setNativeProps".yarn e2e:ios: see "iOS verification (2026-09-28)" below.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/componentsminor.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 reportsnative refs: input TextInput, autocomplete TextInputand the Input showsset through setNativeProps.Inputsection: typing still works; oldAutocompletesection: typingstshows Star Wars / Interstellar, picking Star Wars fills the field.yarn e2e:iosagainst a Metro serving this branch (the flags injected into a scratch copy of the scripts; without themagent-device testloads the bundle from:8081):smoke.adandicon-touchable.adpass;modal-nested.ad(step 51) andautocomplete.adfail 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:8081and 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 throughsetNativeProps; the Autocomplete withtextInputReffilters on typing.Inputtyping and oldAutocomplete(fillst-> 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.adis 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.