react-native icon indicating copy to clipboard operation
react-native copied to clipboard

TextInput placeholder remains empty when multiline is true and the placeholder is set after certain timeout

Open endronk opened this issue 4 years ago • 8 comments

Description

A bug with TextInput when multiline is true and the placeholder is set after certain timeout. This bug only happens on iOS. It works fine on Android.

React Native version:

System:
    OS: macOS 11.0.1
    CPU: (8) x64 VirtualApple @ 2.50GHz processor
    Memory: 65.97 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 26, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.3
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242-release - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.1 => 0.64.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Create a TextInput, then set the multiline props to true and leave the placeholder value empty.
  2. Set a timeout to run a function that will set the placeholder value to a certain text.
  3. On time out, the placeholder will remain empty.

Expected Results

On time out, the placeholder should show up with the value similar to the text set.

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

https://github.com/endronk/textinput-placeholder-multiline-bug

endronk avatar May 23 '21 05:05 endronk

Interesting, thank you for the repro!

I was able to reproduce it, the placeholder prop is not handling updates correctly.

safaiyeh avatar May 24 '21 01:05 safaiyeh

I'm having the same issue, there are any news about a fix?

dadolens avatar Sep 29 '21 09:09 dadolens

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

stale[bot] avatar Jan 09 '22 03:01 stale[bot]

Any news?

dadolens avatar Jan 10 '22 09:01 dadolens

init value set space can fixed <TextArea placeholder={pageType === 'detail' ? ' ' : 'hello world'} ... />

johnmeng24 avatar Jan 21 '22 11:01 johnmeng24

Any updates on this? I'm still experiencing this same issue.

peterhuijsen avatar Apr 09 '22 11:04 peterhuijsen

[!IMPORTANT] ⚠️ This is the workaround ⚠️

init value set space can fixed <TextArea placeholder={pageType === 'detail' ? ' ' : 'hello world'} ... /> @johnmeng24

Dynamic placeholders can be fixed by using ' ' (space character) as the empty value instead of an empty string ('') or undefined.

orlando avatar Aug 17 '23 21:08 orlando

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 23 '24 05:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 30 '24 05:04 github-actions[bot]