question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextInput without label wraps the value of the field

See original GitHub issue

Current 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)

Screen Shot 2021-04-26 at 10 27 47 AM

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:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lmcjt37commented, May 13, 2021

@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.

0reactions
lukewalczakcommented, May 13, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found