Skip to content

Commit eb008e1

Browse files
committed
FlatList add scrollEventThrottle prop
1 parent afb2d08 commit eb008e1

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

‎lib/js/src/components/flatList.js‎

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/components/flatList.re‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ module type FlatListComponent = {
110110
~windowSize: int=?,
111111
~maxToRenderPerBatch: int=?,
112112
~viewabilityConfig: Js.t({.})=?,
113+
~scrollEventThrottle: int=?,
113114
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
114115
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
115116
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
@@ -294,6 +295,7 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
294295
~windowSize=?,
295296
~maxToRenderPerBatch=?,
296297
~viewabilityConfig=?,
298+
~scrollEventThrottle=?,
297299
~onScroll=?,
298300
~onScrollBeginDrag=?,
299301
~onScrollEndDrag=?,
@@ -314,10 +316,9 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
314316
"data": data,
315317
"extraData": extraData,
316318
"getItemLayout":
317-
getItemLayout
318-
->Belt.Option.map((f, data, index) =>
319-
f(Js.Undefined.toOption(data), index)
320-
),
319+
getItemLayout->Belt.Option.map((f, data, index) =>
320+
f(Js.Undefined.toOption(data), index)
321+
),
321322
"horizontal": horizontal,
322323
"initialNumToRender": initialNumToRender,
323324
"initialScrollIndex": initialScrollIndex,
@@ -329,13 +330,12 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
329330
"onRefresh": onRefresh,
330331
"onViewableItemsChanged": onViewableItemsChanged,
331332
"overScrollMode":
332-
overScrollMode
333-
->Belt.Option.map(
334-
fun
335-
| `auto => "auto"
336-
| `always => "always"
337-
| `never => "never",
338-
),
333+
overScrollMode->Belt.Option.map(
334+
fun
335+
| `auto => "auto"
336+
| `always => "always"
337+
| `never => "never",
338+
),
339339
"pagingEnabled": pagingEnabled,
340340
"refreshControl": refreshControl,
341341
"refreshing": refreshing,
@@ -349,6 +349,7 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
349349
"windowSize": windowSize,
350350
"maxToRenderPerBatch": maxToRenderPerBatch,
351351
"viewabilityConfig": viewabilityConfig,
352+
"scrollEventThrottle": scrollEventThrottle,
352353
"onScroll": onScroll,
353354
"onScrollBeginDrag": onScrollBeginDrag,
354355
"onScrollEndDrag": onScrollEndDrag,

‎src/components/flatList.rei‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ module type FlatListComponent = {
380380
~windowSize: int=?,
381381
~maxToRenderPerBatch: int=?,
382382
~viewabilityConfig: Js.t({.})=?,
383+
~scrollEventThrottle: int=?,
383384
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
384385
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
385386
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,

0 commit comments

Comments
 (0)