Skip to content
Permalink
Browse files

Enable removeClippedSubviews on Android only for improved scrolling p…

…erformance

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
  • Loading branch information...
fred2028 authored and facebook-github-bot committed Dec 12, 2018
1 parent dc52cc5 commit 1a499f43b2d03cc27dd6c25c8f13a767862afba1
Showing with 11 additions and 0 deletions.
  1. +7 −0 Libraries/Lists/FlatList.js
  2. +4 −0 Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap
@@ -9,6 +9,7 @@
*/
'use strict';

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

@@ -49,6 +49,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
/>
}
refreshing={false}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={Array []}
@@ -143,6 +144,7 @@ exports[`FlatList renders empty list 1`] = `
onScroll={[Function]}
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={Array []}
@@ -171,6 +173,7 @@ exports[`FlatList renders null list 1`] = `
onScroll={[Function]}
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={Array []}
@@ -212,6 +215,7 @@ exports[`FlatList renders simple list 1`] = `
onScroll={[Function]}
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={Array []}

0 comments on commit 1a499f4

Please sign in to comment.
You can’t perform that action at this time.