From 75b9fd0eeecf536767aae45820a0940b42c94608 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 01:33:35 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Add=20windowing=20props=20t?= =?UTF-8?q?o=20FlatList=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added `initialNumToRender`, `windowSize`, `maxToRenderPerBatch`, and `removeClippedSubviews` to `FlatList` components across `FlightScreen`, `PasswordScreen`, and `CalendarScreen` to optimize rendering performance and memory usage for long lists. Co-authored-by: TargetMisser <52361977+TargetMisser@users.noreply.github.com> --- .jules/bolt.md | 4 ++++ src/screens/CalendarScreen.tsx | 14 +++++++++----- src/screens/FlightScreen.tsx | 4 ++++ src/screens/PasswordScreen.tsx | 4 ++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index e37d378..538a8fa 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -1,3 +1,7 @@ ## 2024-04-13 - Missing React.memo for FlatList Items **Learning:** The React Native FlatList components in this codebase frequently render unmemoized inline items (like `ContactRow`, `PasswordRow`, etc.), causing unnecessary re-renders of the entire list when individual state changes. **Action:** Always wrap long list item components in `React.memo()` to prevent cascading re-renders and improve FlatList scrolling performance. + +## 2026-04-26 - Missing FlatList Windowing Props +**Learning:** FlatList components in React Native were rendering without windowing props, which can lead to poor performance on long lists due to excessive memory usage and rendering overhead. +**Action:** Always add windowing props (`initialNumToRender`, `windowSize`, `maxToRenderPerBatch`, etc.) to `FlatList` components to optimize memory and rendering performance. diff --git a/src/screens/CalendarScreen.tsx b/src/screens/CalendarScreen.tsx index 8399c70..b186185 100644 --- a/src/screens/CalendarScreen.tsx +++ b/src/screens/CalendarScreen.tsx @@ -663,11 +663,15 @@ export default function CalendarScreen() { {t('calPickName')} ({parsedSchedule.employees.length} trovati) - String(i)} - style={{ maxHeight: 400 }} - nestedScrollEnabled + String(i)} + style={{ maxHeight: 400 }} + nestedScrollEnabled + initialNumToRender={15} + windowSize={5} + maxToRenderPerBatch={10} + removeClippedSubviews={true} renderItem={({ item }) => ( item.flight?.identification?.id || String(i)} renderItem={renderFlight} + initialNumToRender={10} + windowSize={5} + maxToRenderPerBatch={10} + removeClippedSubviews={true} contentContainerStyle={{ padding: 16, paddingBottom: 96 }} refreshControl={ { setRefreshing(true); fetchAll(); }} tintColor={colors.primary} />} ListEmptyComponent={{t('flightNoFlights')}} diff --git a/src/screens/PasswordScreen.tsx b/src/screens/PasswordScreen.tsx index a9611d8..1f232a2 100644 --- a/src/screens/PasswordScreen.tsx +++ b/src/screens/PasswordScreen.tsx @@ -307,6 +307,10 @@ export default function PasswordScreen() { item.id} + initialNumToRender={15} + windowSize={5} + maxToRenderPerBatch={10} + removeClippedSubviews={true} renderItem={({ item }) => (