[iOS/iPadOS] - `FlatList` refresh handling broken/dysfunctional
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
Description
Description
Since upgrading to the new architecture it seems like the refresh/pull-to-refresh feature of the FlatList is broken/not fully functional any longer. However, this is only the case if you place another FlatList OR ScrollView in the same view. Placing just a list in each view does not lead to problems.
Pulling down and refreshing works twice before being dysfunctional. Eventually, after a certain pattern, the functionality works again twice and then breaks again.
The sample code provided below works as intended on the old architecture.
Version
0.71.3
Output of npx react-native info
Not relevant for this issue.
Steps to reproduce
- Create a new
react-nativeproject with the help of the CLI, install all dependencies and pods and build the application on a iOS/iPadOS device. - Paste the provided code into the
App.tsxfile - Pull down the list and notice how the loading spinner is displayed for a brief time
- Use the
Switchbutton to unmount the current view and mount another one containing twoFlatListcomponents and aScrollView(for demonstration purposes). - Pull to refresh on the most left
FlatList(orange one) and once again use theSwitchbutton - Pull down the initial list and notice how the loading spinner is NOT displayed and the
onRefreshhandler is not called
Snack, code example, screenshot, or link to a repository
https://github.com/coolersham/NRNA-flatlist-reload-bug
import React, { useState } from "react"
import {
FlatList,
ScrollView,
Text,
TouchableOpacity,
View,
} from "react-native"
export default function App(): JSX.Element {
return (
<View
style={{
flex: 1,
padding: 48,
alignItems: "center",
backgroundColor: "white",
}}
>
<ListDemo />
</View>
)
}
function ListDemo() {
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const [show, setShow] = useState(true)
const style = { backgroundColor: "orange" }
const switchButton = (
<TouchableOpacity
style={{
height: 48,
width: 300,
alignItems: "center",
backgroundColor: "red",
justifyContent: "center",
}}
onPress={() => setShow((show) => !show)}
>
<Text style={{ color: "white" }}>Switch</Text>
</TouchableOpacity>
)
if (show)
return (
<>
{switchButton}
<FlatList
data={data}
style={style}
refreshing={false}
renderItem={GenericListItem}
onRefresh={() => console.log("List #1 refresh is called")}
/>
</>
)
return (
<>
{switchButton}
<View
style={{
flex: 1,
flexDirection: "row",
}}
>
<FlatList
data={data}
style={style}
refreshing={false}
renderItem={GenericListItem}
onRefresh={() => console.log("List #2 refresh is called")}
/>
{/* Breaks refresh handling of both lists occasionally */}
<FlatList
data={data}
renderItem={GenericListItem}
style={{ backgroundColor: "purple" }}
/>
{/* The same applies to the normal ScrollView component */}
<ScrollView style={{ backgroundColor: "blue" }}>
{data.map((item) => (
<GenericListItem key={item} />
))}
</ScrollView>
</View>
</>
)
}
function GenericListItem() {
return (
<View style={{ width: 300, height: 48 }}>
<Text>Generic test item</Text>
</View>
)
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた再現プロジェクトとその App.tsx から始め、新アーキテクチャを使用して iOS/iPadOS デバイス上で更新シーケンスを再現します。複数の FlatList または ScrollView コンポーネントを含むビューを切り替えても、最初のリストの spinner または onRefresh ハンドラーが無効にならなければ、fix は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ios, react-native, typescript
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100