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.

Placeholder's TextInput breaking lines after change on Android

See original GitHub issue

Description

When component start, works fine. After change value from <TextInput /> and delete it, the placeholder appears, passes 1 second and it break line.

React Native version:

    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 102.36 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.5.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.3.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242-release - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Access snack and set Android
  2. Type on TextInput to disappear placeholder
  3. Break placeholder

Expected Results

Placeholder not break line after disappear

Snack, code example, screenshot, or link to a repository:

https://snack.expo.io/z7tbAWsYc

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

15reactions
chrisgleincommented, Jan 12, 2021

Was able to repro in the snack.

  1. Initial state image

  2. Type something image

  3. After deleting the text you just typed, the placeholder text no longer respects numberOfLines image

2reactions
SparkleFaerieCodercommented, Nov 9, 2021

Hi, I’m also running into this issue. Any updates on this by chance?

I don’t know if it helps others in the meantime, but I found by forcing the minWidth of the input to be large than to contentSize of the placeholder. For me, that ended up ‘95%’ of the container width (to account for padding). It was not the most ideal solution, but it was the simplest trying to resolve it until this was actually addressed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Position of placeholder text in (multiline) TextInput for Android ...
On Android, it's putting the placeholder text as centered vertically! I've checked and there are no styles in any parent component that ...
Read more >
line-break - CSS: Cascading Style Sheets - MDN Web Docs
The line-break CSS property sets how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols.
Read more >
TextInput - React Native
Note that on Android performing text selection in an input can change the app's activity windowSoftInputMode param to adjustResize . This may ...
Read more >
placeholder-shown - CSS-Tricks
The :placeholder-shown pseudo-class selects the input element itself when placeholder text exists in a form input. Think of it as a nice.
Read more >
React Native Set Default PlaceHolder Text in TextInput ...
By seeing the PlaceHolder user knows what type of value or information required to fill inside Text Input component.When user starts typing the ......
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