TextInput without a label is invisible while it is empty and unfocused
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react-native, typescript
- Domain
- frontend
Research direction
Start with src/components/TextInput/hooks.ts and TextInput.tsx:401, where animatedContainerStyle is applied to the native input wrapper. Check how opacity depends on whether a label is present, then add or adapt a test for an empty, unfocused TextInput without a label. Done when its placeholder is visible while the labeled input keeps its floating-label behavior.
Written by the indexing model from the issue text.
Description
Current behaviour
A TextInput with no label is invisible while it is empty and unfocused: its input, its placeholder and any prefix or suffix have opacity 0, so only the outline shows until the field is focused. The wrapper around the native input takes the label float opacity (animatedContainerStyle in src/components/TextInput/hooks.ts, applied at TextInput.tsx:401) whether or not there is a label, and that value is 0 while the field is empty and unfocused. In 5.x the placeholder was visible.
Expected behaviour
A TextInput without a label shows its input and placeholder at full opacity at all times. Only a TextInput with a label hides the input while the label rests in its place.
How to reproduce?
const [query, setQuery] = React.useState('');
<TextInput
variant="outlined"
placeholder="Search for plugins..."
value={query}
onChangeText={setQuery}
/>
- Render it: only the outline shows, with no placeholder.
- In a test,
expect(screen.getByPlaceholderText('Search for plugins...')).toBeVisible()fails with "Received element is not visible".
What have you tried so far?
Applying animatedContainerStyle only when label is set keeps the floating label behaviour and shows the placeholder.
Your Environment
| software | version |
|---|---|
| react-native | 0.88.1 |
| react-native-paper | 6.0.0-alpha.1 and main at c8d8bab |
- Dominant language
- TypeScript
- Stars
- 14.5k
- Forks
- 2.3k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from callstack/react-native-paper
-
feature request
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
callstack/react-native-paper#5189 ·
Maintainers usually reply within 1 day
-
Accessibility example app good first task
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
callstack/react-native-paper#5182 ·
Maintainers usually reply within 1 day
-
Accessibility bug web
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
callstack/react-native-paper#5180 ·
Maintainers usually reply within 1 day
-
Chip: accessibilityState passed by caller is discarded; aria-checked is never forwarded to the real rendered nodePossibly taken @bhumikabiyani claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
callstack/react-native-paper#5146 · 2 comments ·
Maintainers usually reply within 1 day
-
Tooltip: onPress event object is not propagated to parent component on nativePossibly taken @aliyilmaztech claimed this 86 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
callstack/react-native-paper#5003 ·
Maintainers usually reply within 1 day
All issues in callstack/react-native-paper
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
pending close triaging
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
anomalyco/opencode#62582 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
live-codes/livecodes#1079 · 1 comment ·
Maintainers usually reply within 1 day
-
Add: ESP 2 ROOpenapproved check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day