Skip to content

fix(text-input): keep a TextInput without a label visible while empty - #5191

Open
RClaudiuM wants to merge 1 commit into
callstack:mainfrom
RClaudiuM:fix/5187-textinput-no-label-visible
Open

RClaudiuM wants to merge 1 commit into
callstack:mainfrom
RClaudiuM:fix/5187-textinput-no-label-visible

Conversation

@RClaudiuM

Copy link
Copy Markdown

Motivation

A TextInput without a label is invisible while it is empty and unfocused: only the outline shows, and the input and its placeholder appear only after the field gets focus. The wrapper around the native input always took the label float opacity (animatedContainerStyle), which is 0 while the field is empty and unfocused, even when there is no label to rest in the input's place.

useTextInput now passes that animated opacity only when a label is set. A labelled field keeps its behaviour: the input stays hidden while the label rests in its place and fades in as the label floats. A field without a label shows its input and placeholder at all times, as in 5.x.

Related issue

Fixes #5187

Related: #5111 drops this wrapper opacity as part of its wider TextInput MD3 rework. This is the minimal fix for main on its own.

Screenshots / Videos

No visual change for labelled fields. Unlabelled fields show their placeholder before focus instead of rendering as an empty outline.

Test plan

New tests in src/components/__tests__/TextInput.test.tsx:

  • keeps an empty, unfocused filled|outlined TextInput without a label visible: getByPlaceholderText(...) is toBeVisible(). Both fail on main with "Received instance is not visible" and pass with this change.
  • hides the input of an empty, unfocused TextInput while its label rests in place: guards the labelled behaviour. Passes before and after.

Checks run locally:

  • yarn test: 54 suites, 785 passed, 1 skipped
  • yarn lint, yarn typecheck and tsc -p tsconfig.build.json --noEmit --customConditions react-native-paper-source,react-native-legacy-deep-imports: clean

Manual: render <TextInput variant="outlined" placeholder="Search for plugins..." value="" onChangeText={...} /> in the example app. The placeholder shows without focusing the field.

The input container took the label float opacity whether or not a label was set, so an empty, unfocused TextInput without a label hid its input and placeholder. Apply that opacity only when there is a label to rest in the input's place.
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.
  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

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.

TextInput without a label is invisible while it is empty and unfocused

1 participant