react / react/react-native

Incorrect `flexGrow` behavior inside `<ScrollView contentContainerStyle={{ flexGrow: 1 }}>`

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

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

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

説明

Description

Android (incorrect):

image

Note different heights.

Web (correct):

image

React Native Version

0.72.5

Output of npx react-native info
> npx react-native info
info Fetching system and libraries information...
System:
  OS: Windows 10 10.0.22621
  CPU: "(12) x64 AMD Ryzen 5 5600 6-Core Processor              "
  Memory: 18.43 GB / 31.91 GB
Binaries:
  Node:
    version: 20.2.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.7.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.5.33424.131 (Visual Studio Community 2022)
Languages:
  Java:
    version: 11.0.20.1
    path: C:\Program Files\Eclipse Adoptium\jdk-11.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Steps to reproduce
import { Text, View, ScrollView } from 'react-native';

export default function App() {
  return (
			<>
      <View style={{ position: 'absolute', left: 20, height: 150 }}>
			<View style={{ flexGrow: 1 }}>
				<View style={{ width: 300, flexGrow: 1 }}>
					{[['foo', 'bar'],['baz','A very long but very very long sentence']].map((row, index) => (
						<View style={{ flexDirection: 'row', backgroundColor: index === 0 ? 'red' : 'blue', flexBasis: 0, flexGrow: 1 }} key={index}>
							{row.map((answer) => (
								<Text key={answer} style={{ flexBasis: 0, fontSize: 16,  flexGrow: 1 }}>{answer}</Text>
							))}
						</View>
					))}
				</View>
			</View>
			</View>

      <View style={{ height: 150 }}>
        <ScrollView  contentContainerStyle={{ flexGrow: 1 }}>
          <View style={{ width: 300, flexGrow: 1 }}>
            {[['foo', 'bar'],['baz','A very long but very very long sentence']].map((row, index) => (
              <View style={{ flexDirection: 'row', backgroundColor: index === 0 ? 'purple' : 'orange', flexBasis: 0, flexGrow: 1 }} key={index}>
                {row.map((answer) => (
                  <Text key={answer} style={{ flexBasis: 0, fontSize: 16,  flexGrow: 1 }}>{answer}</Text>
                ))}
              </View>
            ))}
          </View>
        </ScrollView>
			</View>
      </>
  );
}

Use an Android device.

Snack, screenshot, or link to a repository

https://snack.expo.dev/@szmarczak/mad-orange-apple

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

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

はじめの一歩

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

調査の方向性

リンク先の Expo Snack と提供された再現ケースを Android デバイスで開始し、その flexGrow レイアウトをレポートに示された Web の結果と比較します。関係する ScrollView と contentContainerStyle の動作を追跡します。完了の条件は、Android のレイアウトが期待される結果と一貫して flexGrow を処理し、再現ケースで異なる高さが表示されなくなることです。

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

評価

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

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

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