Skip to content

Commit 5f4f54c

Browse files
committed
Add ScrollView/FlatList onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd props
1 parent 4eb05b7 commit 5f4f54c

9 files changed

Lines changed: 111 additions & 80 deletions

File tree

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

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

‎lib/js/src/components/scrollView.js‎

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

‎src/components/animatedComponents.rei‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ module ScrollView: {
4545
~keyboardShouldPersistTaps: [ | `always | `handled | `never]=?,
4646
~onContentSizeChange: ((float, float)) => unit=?,
4747
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
48+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
49+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
50+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
51+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
4852
~pagingEnabled: bool=?,
4953
~refreshControl: ReasonReact.reactElement=?,
5054
~scrollEnabled: bool=?,

‎src/components/flatList.re‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ module type FlatListComponent = {
111111
~maxToRenderPerBatch: int=?,
112112
~viewabilityConfig: Js.t({.})=?,
113113
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
114+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
115+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
116+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
117+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
114118
~style: Style.t=?,
115119
array(ReasonReact.reactElement)
116120
) =>
@@ -284,6 +288,10 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
284288
~maxToRenderPerBatch=?,
285289
~viewabilityConfig=?,
286290
~onScroll=?,
291+
~onScrollBeginDrag=?,
292+
~onScrollEndDrag=?,
293+
~onMomentumScrollBegin=?,
294+
~onMomentumScrollEnd=?,
287295
~style=?,
288296
) =>
289297
ReasonReact.wrapJsForReason(
@@ -334,6 +342,10 @@ module CreateComponent = (Impl: View.Impl) : FlatListComponent => {
334342
"maxToRenderPerBatch": maxToRenderPerBatch,
335343
"viewabilityConfig": viewabilityConfig,
336344
"onScroll": onScroll,
345+
"onScrollBeginDrag": onScrollBeginDrag,
346+
"onScrollEndDrag": onScrollEndDrag,
347+
"onMomentumScrollBegin": onMomentumScrollBegin,
348+
"onMomentumScrollEnd": onMomentumScrollEnd,
337349
"style": style,
338350
},
339351
);

‎src/components/flatList.rei‎

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -208,31 +208,32 @@ module type FlatListComponent = {
208208
{[
209209
onScroll: RNEvent.NativeScrollEvent.t => unit=?
210210
]}
211-
reference:
212-
{4 RNEvent.rei}
213-
{[
214-
module NativeScrollEvent: {
215-
type t;
216-
type point = {
217-
x: float,
218-
y: float
219-
};
220-
type size = {
221-
width: float,
222-
height: float
223-
};
224-
type contentInset = {
225-
bottom: float,
226-
top: float,
227-
left: float,
228-
right: float
229-
};
230-
let contentOffset: t => point;
231-
let contentSize: t => size;
232-
let contentInset: t => contentInset;
233-
let layoutMeasurement: t => size;
234-
};
211+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
212+
213+
{4 onScrollBeginDrag}
214+
{[
215+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
216+
]}
217+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
218+
219+
{4 onScrollEndDrag}
220+
{[
221+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
235222
]}
223+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
224+
225+
{4 onMomentumScrollBegin}
226+
{[
227+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
228+
]}
229+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
230+
231+
{4 onMomentumScrollEnd}
232+
{[
233+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
234+
]}
235+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
236+
236237
{4 style}
237238
{[
238239
style: Style.t=?
@@ -370,6 +371,10 @@ module type FlatListComponent = {
370371
~maxToRenderPerBatch: int=?,
371372
~viewabilityConfig: Js.t({.})=?,
372373
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
374+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
375+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
376+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
377+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
373378
~style: Style.t=?,
374379
array(ReasonReact.reactElement)
375380
) =>

‎src/components/image.rei‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,8 @@ module type ImageComponent = {
5050
{[
5151
onLayout: RNEvent.NativeLayoutEvent.t => unit=?
5252
]}
53-
reference:
54-
{4 RNEvent.rei}
55-
{[
56-
module NativeLayoutEvent: {
57-
type t;
58-
type layout = {
59-
x: float,
60-
y: float,
61-
width: float,
62-
height: float
63-
};
64-
let layout: t => layout;
65-
};
66-
]}
53+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeLayoutEvent/} [RNEvent.NativeLayoutEvent]}
54+
6755
{4 onLoad}
6856
{[
6957
onLoad: unit => unit=?

‎src/components/picker.rei‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,8 @@
100100
{[
101101
onLayout: RNEvent.NativeLayoutEvent.t => unit=?
102102
]}
103-
reference:
104-
{4 RNEvent.rei}
105-
{[
106-
module NativeLayoutEvent: {
107-
type t;
108-
type layout = {
109-
x: float,
110-
y: float,
111-
width: float,
112-
height: float
113-
};
114-
let layout: t => layout;
115-
};
116-
]}
103+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeLayoutEvent/} [RNEvent.NativeLayoutEvent]}
104+
117105
{4 onMagicTap}
118106
{[
119107
onMagicTap: unit => unit=?

‎src/components/scrollView.re‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module type ScrollViewComponent = {
3434
~keyboardShouldPersistTaps: [ | `always | `never | `handled]=?,
3535
~onContentSizeChange: ((float, float)) => unit=?,
3636
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
37+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
38+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
39+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
40+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
3741
~pagingEnabled: bool=?,
3842
~refreshControl: ReasonReact.reactElement=?,
3943
~scrollEnabled: bool=?,
@@ -123,6 +127,10 @@ module CreateComponent = (Impl: View.Impl) : ScrollViewComponent => {
123127
~keyboardShouldPersistTaps=?,
124128
~onContentSizeChange=?,
125129
~onScroll=?,
130+
~onScrollBeginDrag=?,
131+
~onScrollEndDrag=?,
132+
~onMomentumScrollBegin=?,
133+
~onMomentumScrollEnd=?,
126134
~pagingEnabled=?,
127135
~refreshControl=?,
128136
~scrollEnabled=?,
@@ -176,6 +184,10 @@ module CreateComponent = (Impl: View.Impl) : ScrollViewComponent => {
176184
),
177185
"onContentSizeChange": onContentSizeChange,
178186
"onScroll": onScroll,
187+
"onScrollBeginDrag": onScrollBeginDrag,
188+
"onScrollEndDrag": onScrollEndDrag,
189+
"onMomentumScrollBegin": onMomentumScrollBegin,
190+
"onMomentumScrollEnd": onMomentumScrollEnd,
179191
"pagingEnabled": pagingEnabled,
180192
"refreshControl": refreshControl,
181193
"scrollEnabled": scrollEnabled,

‎src/components/scrollView.rei‎

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,37 @@ module type ScrollViewComponent = {
3737
{[
3838
~onContentSizeChange: ((float, float)) => unit=?,
3939
]}
40+
4041
{4 onScroll}
4142
{[
4243
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
4344
]}
44-
reference:
45-
{4 RNEvent.rei}
46-
{[
47-
module NativeScrollEvent: {
48-
type t;
49-
type point = {
50-
x: float,
51-
y: float
52-
};
53-
type size = {
54-
width: float,
55-
height: float
56-
};
57-
type contentInset = {
58-
bottom: float,
59-
top: float,
60-
left: float,
61-
right: float
62-
};
63-
let contentOffset: t => point;
64-
let contentSize: t => size;
65-
let contentInset: t => contentInset;
66-
let layoutMeasurement: t => size;
67-
};
45+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
46+
47+
{4 onScrollBeginDrag}
48+
{[
49+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
50+
]}
51+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
52+
53+
{4 onScrollEndDrag}
54+
{[
55+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
6856
]}
57+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
58+
59+
{4 onMomentumScrollBegin}
60+
{[
61+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
62+
]}
63+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
64+
65+
{4 onMomentumScrollEnd}
66+
{[
67+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
68+
]}
69+
Reference {{:/BsReactNative/RNEvent-BsReactNative/NativeScrollEvent/} [RNEvent.NativeScrollEvent]}
70+
6971
{4 pagingEnabled}
7072
{[
7173
~pagingEnabled: bool=?,
@@ -249,6 +251,10 @@ module type ScrollViewComponent = {
249251
~keyboardShouldPersistTaps: [ | `always | `handled | `never]=?,
250252
~onContentSizeChange: ((float, float)) => unit=?,
251253
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
254+
~onScrollBeginDrag: RNEvent.NativeScrollEvent.t => unit=?,
255+
~onScrollEndDrag: RNEvent.NativeScrollEvent.t => unit=?,
256+
~onMomentumScrollBegin: RNEvent.NativeScrollEvent.t => unit=?,
257+
~onMomentumScrollEnd: RNEvent.NativeScrollEvent.t => unit=?,
252258
~pagingEnabled: bool=?,
253259
~refreshControl: ReasonReact.reactElement=?,
254260
~scrollEnabled: bool=?,

0 commit comments

Comments
 (0)