Skip to content

Commit 1a499f4

Browse files
fred2028facebook-github-bot
authored andcommittedDec 12, 2018
Enable removeClippedSubviews on Android only for improved scrolling performance
Summary: Android scrolling performance is very poor with this disabled. iOS has some KP with this enabled, so disable it for iOS. Reviewed By: sahrens Differential Revision: D13363494 fbshipit-source-id: efab77b5db9676dd0521ae4193465d45ac34dda3
1 parent dc52cc5 commit 1a499f4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎Libraries/Lists/FlatList.js

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
'use strict';
1111

12+
const Platform = require('Platform');
1213
const deepDiffer = require('deepDiffer');
1314
const React = require('React');
1415
const View = require('View');
@@ -219,6 +220,12 @@ export type Props<ItemT> = RequiredProps<ItemT> &
219220
const defaultProps = {
220221
...VirtualizedList.defaultProps,
221222
numColumns: 1,
223+
/**
224+
* Enabling this prop on Android greatly improves scrolling performance with no known issues.
225+
* The alternative is that scrolling on Android is unusably bad. Enabling it on iOS has a few
226+
* known issues.
227+
*/
228+
removeClippedSubviews: Platform.OS === 'android',
222229
};
223230
export type DefaultProps = typeof defaultProps;
224231

‎Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
4949
/>
5050
}
5151
refreshing={false}
52+
removeClippedSubviews={false}
5253
renderItem={[Function]}
5354
scrollEventThrottle={50}
5455
stickyHeaderIndices={Array []}
@@ -143,6 +144,7 @@ exports[`FlatList renders empty list 1`] = `
143144
onScroll={[Function]}
144145
onScrollBeginDrag={[Function]}
145146
onScrollEndDrag={[Function]}
147+
removeClippedSubviews={false}
146148
renderItem={[Function]}
147149
scrollEventThrottle={50}
148150
stickyHeaderIndices={Array []}
@@ -171,6 +173,7 @@ exports[`FlatList renders null list 1`] = `
171173
onScroll={[Function]}
172174
onScrollBeginDrag={[Function]}
173175
onScrollEndDrag={[Function]}
176+
removeClippedSubviews={false}
174177
renderItem={[Function]}
175178
scrollEventThrottle={50}
176179
stickyHeaderIndices={Array []}
@@ -212,6 +215,7 @@ exports[`FlatList renders simple list 1`] = `
212215
onScroll={[Function]}
213216
onScrollBeginDrag={[Function]}
214217
onScrollEndDrag={[Function]}
218+
removeClippedSubviews={false}
215219
renderItem={[Function]}
216220
scrollEventThrottle={50}
217221
stickyHeaderIndices={Array []}

0 commit comments

Comments
 (0)
Please sign in to comment.