Skip to content

Commit

Permalink
Set batch size to 1 only on web
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Sep 21, 2023
1 parent 5707b9d commit 2c16083
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/components/InvertedFlatList/BaseInvertedFlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ class BaseInvertedFlatList extends Component {
// Native platforms do not need to measure items and work fine without this.
// Web requires that items be measured or else crazy things happen when scrolling.
getItemLayout={this.props.shouldMeasureItems ? this.getItemLayout : undefined}
// Keep batch size relatively small for responsiveness, but not too small as it will cause
// excessive rendering. See https://github.com/Expensify/App/pull/19345 for performance testing
// of this value.
maxToRenderPerBatch={10}
windowSize={15}

// Commenting the line below as it breaks the unread indicator test
Expand Down
3 changes: 3 additions & 0 deletions src/components/InvertedFlatList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ function InvertedFlatList(props) {
shouldMeasureItems
contentContainerStyle={StyleSheet.compose(contentContainerStyle, styles.justifyContentEnd)}
onScroll={handleScroll}
// We need to keep batch size to one to workaround a bug in react-native-web.
// This can be removed once https://github.com/Expensify/App/pull/24482 is merged.
maxToRenderPerBatch={1}
/>
);
}
Expand Down

0 comments on commit 2c16083

Please sign in to comment.