react / react/react-native

Different TextInput behavior with flex-basis:0

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

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

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

説明

Description

Android and IOS exhibit different behaviors in the following scenario: a textInput with a thick border and flex:1, within a view with flex:1.

On Android, the border is not taken into account to determine the size to allot to the textInput.

Possibly related to https://github.com/facebook/react-native/issues/38518

React Native Version

0.72.3

Output of npx react-native info

System:
OS: Windows 10 10.0.19045
CPU: (32) x64 AMD Ryzen Threadripper PRO 3955WX 16-Cores
Memory: 92.13 GB / 127.86 GB
Binaries:
Node:
version: 20.4.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 9.8.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio:
- 17.6.33723.286 (Visual Studio Community 2022)
Languages:
Java: 1.8.0_372
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

In the example below, the text is below the textInput's border on web and iOS, but above the border on Android, leaving almost no room for the textInput's background.

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

https://snack.expo.dev/ANgohiA9k?platform=android

        <View style={{maxHeight:1000, minHeight:50, backgroundColor:'green'}}>
          <View style={{backgroundColor: 'yellow',
              flex:1,
              height:200,
              marginTop: 20,
              }}>
            <TextInput style={{borderTopWidth: 20, borderColor: 'red', backgroundColor:'blue', height:100, flex:1, padding:0 }}
              editable
              multiline
              value="bla bla bla 2"/>
          </View>
        </View>

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

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

はじめの一歩

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

調査の方向性

issue にリンクされている Snack の再現コードから始め、Android、iOS、web で実行します。提供されたネストされた View の例における TextInput のレイアウトを比較します。特に、20px の上部ボーダー、flex:1 によるサイズ設定、複数行テキストの配置を確認します。各プラットフォームでボーダーが一貫して考慮され、テキストと背景が同等の間隔で描画されれば完了です。

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

評価

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

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

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