react / react/react-native

Android TextInput placeholder with custom font has incorrect height

オープン
#31,544 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Component: TextInput Issue: Author Provided Repro
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

TextInput placeholders that do not use the default android font and differ in their wrap point from the default font may be cut off. For example, if the default font does not wrap, and the custom font is slightly wider and does wrap to the next line, the placeholder will NOT reflect this wrapping, and the TextInput will only be one line.

React Native version:

System:
    OS: macOS 11.2.3
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 91.84 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.0.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.10.0 - /usr/local/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: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3, 31.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.10 - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/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

  • Create text input with placeholder string that does not wrap with default font, but does wrap with custom font.
  • Second line will not be visible.

Expected Results

Placeholder should adjust height according to its font.

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

https://snack.expo.io/@computerjazz/textinput-android-bug

expected behavior (in this case placeholder text is long enough that it ALSO would wrap using default font)
Screen Shot 2021-05-18 at 9 27 19

actual behavior (placeholder text using "serif" font wraps to a 3rd line, but if it were to use the default font it would not wrap, and as a result placeholder gets cut off):
Screen Shot 2021-05-18 at 9 22 40

For reference, here's the same text using default font, note that it does not wrap to a 3rd line:
Screen Shot 2021-05-18 at 9 30 30

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

カスタムのセリフフォントと、デフォルトフォントとは異なる位置で折り返されるプレースホルダーを使って、リンク先の Snack で折り返しの違いを再現してください。次に、プレースホルダーのサイズ計算を担当する Android React Native TextInput の実装を追跡し、プレースホルダーの高さに折り返されたすべての行が含まれていることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。