Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const FlatListWithEventThrottle = React.forwardRef(
ref:
| ((null | FlatList<mixed>) => mixed)
| {current: null | FlatList<mixed>, ...},
) => <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />,
) => <FlatList {...props} ref={ref} />,
);

export default (createAnimatedComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SectionListWithEventThrottle = React.forwardRef(
current: null | SectionList<SectionBase<$FlowFixMe>>,
...
},
) => <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />,
) => <SectionList {...props} ref={ref} />,
);

export default (createAnimatedComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`FlatList ignores invalid data 1`] = `
pagingEnabled={false}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
scrollViewRef={[Function]}
sendMomentumEvents={true}
snapToEnd={true}
Expand Down Expand Up @@ -104,7 +104,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
refreshing={false}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down Expand Up @@ -222,7 +222,7 @@ exports[`FlatList renders array-like data 1`] = `
pagingEnabled={false}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
scrollViewRef={[Function]}
sendMomentumEvents={true}
snapToEnd={true}
Expand Down Expand Up @@ -295,7 +295,7 @@ exports[`FlatList renders empty list 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand All @@ -317,7 +317,7 @@ exports[`FlatList renders null list 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down Expand Up @@ -352,7 +352,7 @@ exports[`FlatList renders simple list (multiple columns) 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down Expand Up @@ -425,7 +425,7 @@ exports[`FlatList renders simple list 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down Expand Up @@ -488,7 +488,7 @@ exports[`FlatList renders simple list using ListItemComponent (multiple columns)
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down Expand Up @@ -561,7 +561,7 @@ exports[`FlatList renders simple list using ListItemComponent 1`] = `
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
viewabilityConfigCallbackPairs={Array []}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={
Array [
0,
Expand Down Expand Up @@ -89,7 +89,7 @@ exports[`SectionList renders a footer when there is no data 1`] = `
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={
Array [
0,
Expand Down Expand Up @@ -140,7 +140,7 @@ exports[`SectionList renders a footer when there is no data and no header 1`] =
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={
Array [
0,
Expand Down Expand Up @@ -231,7 +231,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
}
refreshing={false}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={
Array [
1,
Expand Down Expand Up @@ -422,7 +422,7 @@ exports[`SectionList renders empty list 1`] = `
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
renderItem={[Function]}
scrollEventThrottle={50}
scrollEventThrottle={0.0001}
stickyHeaderIndices={Array []}
>
<View />
Expand Down
7 changes: 3 additions & 4 deletions packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import {
maxToRenderPerBatchOrDefault,
onStartReachedThresholdOrDefault,
onEndReachedThresholdOrDefault,
scrollEventThrottleOrDefault,
windowSizeOrDefault,
} from './VirtualizedListProps';

Expand Down Expand Up @@ -1073,9 +1072,9 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
onScrollEndDrag: this._onScrollEndDrag,
onMomentumScrollBegin: this._onMomentumScrollBegin,
onMomentumScrollEnd: this._onMomentumScrollEnd,
scrollEventThrottle: scrollEventThrottleOrDefault(
this.props.scrollEventThrottle,
), // TODO: Android support
// iOS/macOS requires a non-zero scrollEventThrottle to fire more than a
// single notification while scrolling. This will otherwise no-op.
scrollEventThrottle: this.props.scrollEventThrottle ?? 0.0001,
invertStickyHeaders:
this.props.invertStickyHeaders !== undefined
? this.props.invertStickyHeaders
Expand Down
7 changes: 0 additions & 7 deletions packages/virtualized-lists/Lists/VirtualizedListProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,6 @@ export function onEndReachedThresholdOrDefault(
return onEndReachedThreshold ?? 2;
}

// scrollEventThrottleOrDefault(this.props.scrollEventThrottle)
export function scrollEventThrottleOrDefault(
scrollEventThrottle: ?number,
): number {
return scrollEventThrottle ?? 50;
}

// windowSizeOrDefault(this.props.windowSize)
export function windowSizeOrDefault(windowSize: ?number): number {
return windowSize ?? 21;
Expand Down
Loading