OnEndReached calls on initial render and is called even if data is empty
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
Description
OnEndReached calls on initial render when the app runs each time on the first time and is called even if data is empty
React Native Version
0.71.1
Output of npx react-native info
System:
OS: macOS 13.3.1
CPU: (8) arm64 Apple M1
Memory: 207.19 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - /opt/homebrew/opt/node@18/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.5.1 - /opt/homebrew/opt/node@18/bin/npm
Watchman: 2023.05.08.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.19 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.1 => 0.71.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
create a project with the following code
Snack, code example, screenshot, or link to a repository
const HomeScreen = () => {
return (
<SafeAreaView style={{flex:1}}>
<FlatList
data={[]}
renderItem={() => {
return (
<View
style={{
height: 100,
backgroundColor: 'red',
borderRadius: 20,
marginBottom: 20,
}}>
<CustomText>welcome</CustomText>
</View>
);
}}
ListEmptyComponent={() => {
return (
<View>
<Text>Empty List</Text>
</View>
);
}}
onEndReached={() => {
console.log('onEndReached');
}}
/>
</SafeAreaView>
)
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dal comportamento di FlatList con onEndReached usando l’esempio fornito con dati vuoti e il repository di riproduzione collegato. Riproduci il caso del rendering iniziale, quindi segui il punto di ingresso di FlatList per determinare perché il callback viene eseguito senza dati; il lavoro è completato quando il callback non viene più eseguito durante il rendering iniziale quando la lista è vuota.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react-native
- Ambito
- mobile
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100