react / react/react-native

[TextInput] lineheight cuts off content on iOS

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

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

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

説明

Description

The TextInput on iOS cuts off content at dashes (-) if it has the lineHeight style applied to it. This happens when content is to long and therefore isn't completely visible in the input without moving through it.

If the lineHeight isn't applied it is not cut off at the dash (-) and the content will end with ellipsis (...).

We tried removing everything from the input and found out in that way it was the lineHeight that causes this issue.

This only happens on iOS and not on Android.

React Native Version

0.71.13

Output of npx react-native info
System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 55.56 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    Watchman: 2023.10.02.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.13.0 - /Users/thomaslamars/.rvm/gems/ruby-2.7.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.9971841
    Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
  Languages:
    Java: 18.0.2.1 - /Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: ^0.71.13 => 0.71.13 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
Steps to reproduce

It is reproducible by making an TextInput with just lineHeight on it with the styling.
Than as value pass a really long string or type a really long string with dashes.
Get out of focus with the input and see that the value in the input gets truncated.

import { TextInput, SafeAreaView, StyleSheet } from 'react-native';

export default function App() {
  const value = "Thisisareallylong emailwithdashes-init@thawdisisasnackwhichisanexample.com"

  return (
    <SafeAreaView style={styles.container}>
      <TextInput value={value} style={{ lineHeight: 20 }} />
    </SafeAreaView>
  );
}
Snack, screenshot, or link to a repository
Snack url

Reproducible on Snack with expo 49 and react native version 0.72.4
https://snack.expo.dev/l0o3kNldL

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

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

はじめの一歩

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

調査の方向性

まず、長いダッシュ区切りの値を使ってリンクされた Snack の再現手順を実行し、lineHeight の有無による iOS TextInput の動作を比較します。次に、レンダリングと切り詰めを担う iOS TextInput のエントリーポイントを追跡し、Android の動作を変更せずに、長いコンテンツがダッシュの位置で切り詰められなくなったことを確認します。

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

評価

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

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

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