TextInput without label wraps the value of the field
See original GitHub issueCurrent behaviour
When using a TextInput component, if I omit the label prop on iOS and then input something longer than the input’s width, the value will wrap onto the next line. Also note I am not using multiline so this isn’t expected behaviour.
Expected behaviour
I should expect the value not to wrap, but instead clip the value of the text input.
Code sample
import * as React from 'react';
import { TextInput } from 'react-native-paper';
const MyComponent = () => {
const [text, setText] = React.useState('');
return (
<TextInput
value={text}
onChangeText={text => setText(text)}
/>
);
};
export default MyComponent;
Screenshots (if applicable)
What have you tried
Steps to fix: N/A
Steps to reproduce:
- Use a standard paper text input
- Do not define any additional properties for the component, other than what’s needed to change/update text
- Type into the input until the value is longer than the width of the input.
- Tap away from the input (blur) and notice how the value/text wraps (as seen in the screenshot)
Your Environment
software | version |
---|---|
ios | iOS 14.4 (iPhone 11) |
android | N/A |
react-native | 0.63.4 |
react-native-paper | 4.8.1 |
node | 16.0.0 |
npm | 7.10.0 |
yarn | 1.22.5 |
expo sdk | N/A |
react-native-vector-icons | 8.0.0 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Remove Label on Material-UI Select Text Field - Stack Overflow
Save this question. Show activity on this post. I have a select field for gender which has the label positioned in the centre...
Read more >HTML Inputs and Labels: A Love Story | CSS-Tricks
There are two ways to pair a label and an input. One is by wrapping the input in a label (implicit), and the...
Read more >Is it possible to change the Lightning-input label to bold ...
But recently I came across a requirement that says to bold just the label and not the input value field. Below is an...
Read more ><input>: The Input (Form Input) element - HTML
<input> types ; time, A control for entering a time value with no time zone. <input type="time" name="time"/> ; url, A field for...
Read more >Input label does not move up when value or placeholder is sp
In Your case I suggest to replace label by the placeholder attribute. Dynamic input changes very often causes unexpected issues. Best regards. Add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lukewalczak Looks like it is the exact same issue.
textAlign: 'auto'
has fixed the wrapping issue and added the expected ellipsis.Which is great as now I can remove the hack 😅
Happy for this issue to be closed if not needed now.
Hey @lmcjt37, that issue looks similarly to the bug from react-native related to setting
textAlign
which we are handling within our input due to RTL.More details: https://github.com/callstack/react-native-paper/issues/2581.