@@ -20,11 +20,38 @@ type pressEventPayload = {
2020 "pageY": float,
2121 "target": Js.Nullable.t(float),
2222 "timestamp": float,
23- "touches": array(pressEventPayload)
23+ "touches": array(pressEventPayload),
2424};
2525
2626type pressEvent = event(pressEventPayload);
2727
28+ type position = {
29+ .
30+ "y": float,
31+ "x": float
32+ };
33+
34+ type dimensions = {
35+ .
36+ "height": float,
37+ "width": float
38+ };
39+
40+ type scrollEvent =
41+ event({
42+ .
43+ "contentInset": {
44+ .
45+ "bottom": float,
46+ "left": float,
47+ "right": float,
48+ "top": float
49+ },
50+ "contentOffset": position,
51+ "contentSize": dimensions,
52+ "layoutMeasurement": dimensions
53+ });
54+
2855type t;
2956
3057module NativeLayoutEvent = {
@@ -42,43 +69,7 @@ module NativeLayoutEvent = {
4269 };
4370};
4471
45- module NativeScrollEvent = {
46- type t;
47- type point = {
48- x: float,
49- y: float,
50- };
51- type size = {
52- width: float,
53- height: float,
54- };
55- type contentInset = {
56- bottom: float,
57- top: float,
58- left: float,
59- right: float,
60- };
61- [@bs.get] external _nativeEvent: t => Js.t('a) = "nativeEvent";
62- let contentOffset = (t: t) => {
63- let co = _nativeEvent(t)##contentOffset;
64- {x: co##x, y: co##y};
65- };
66- let contentSize = (t: t) => {
67- let cs = _nativeEvent(t)##contentSize;
68- {width: cs##width, height: cs##height};
69- };
70- let layoutMeasurement = (t: t) => {
71- let lm = _nativeEvent(t)##layoutMeasurement;
72- {width: lm##width, height: lm##height};
73- };
74- let contentInset = (t: t) => {
75- let ci = _nativeEvent(t)##contentInset;
76- {bottom: ci##bottom, top: ci##top, left: ci##left, right: ci##right};
77- };
78- };
79-
8072[@bs.get] external nativeLayoutEvent: t => NativeLayoutEvent.t = "nativeEvent";
8173
82- [@bs.get] external nativeScrollEvent: t => NativeScrollEvent.t = "nativeEvent";
8374
8475```
0 commit comments