@tamagui/scroll-view 2.7.6 → 3.0.0-beta.637.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/cjs/ScrollView.cjs +22 -31
  2. package/dist/cjs/ScrollView.native.cjs +35 -0
  3. package/dist/cjs/ScrollView.native.js +21 -30
  4. package/dist/cjs/ScrollView.native.js.map +1 -1
  5. package/dist/cjs/WebScrollView.cjs +270 -0
  6. package/dist/cjs/WebScrollView.native.cjs +346 -0
  7. package/dist/cjs/WebScrollView.native.js +348 -0
  8. package/dist/cjs/WebScrollView.native.js.map +1 -0
  9. package/dist/cjs/index.cjs +10 -11
  10. package/dist/cjs/index.native.cjs +21 -0
  11. package/dist/cjs/index.native.js +10 -10
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/web.cjs +25 -0
  14. package/dist/esm/ScrollView.mjs +9 -13
  15. package/dist/esm/ScrollView.mjs.map +1 -1
  16. package/dist/esm/ScrollView.native.js +8 -13
  17. package/dist/esm/ScrollView.native.js.map +1 -1
  18. package/dist/esm/WebScrollView.mjs +244 -0
  19. package/dist/esm/WebScrollView.mjs.map +1 -0
  20. package/dist/esm/WebScrollView.native.js +318 -0
  21. package/dist/esm/WebScrollView.native.js.map +1 -0
  22. package/dist/esm/index.js +1 -2
  23. package/dist/esm/index.mjs +1 -2
  24. package/dist/esm/index.native.js +1 -2
  25. package/dist/esm/web.mjs +3 -0
  26. package/dist/jsx/ScrollView.mjs +9 -13
  27. package/dist/jsx/ScrollView.mjs.map +1 -1
  28. package/dist/jsx/ScrollView.native.cjs +35 -0
  29. package/dist/jsx/ScrollView.native.js +21 -30
  30. package/dist/jsx/ScrollView.native.js.map +1 -1
  31. package/dist/jsx/WebScrollView.mjs +244 -0
  32. package/dist/jsx/WebScrollView.mjs.map +1 -0
  33. package/dist/jsx/WebScrollView.native.cjs +346 -0
  34. package/dist/jsx/WebScrollView.native.js +348 -0
  35. package/dist/jsx/WebScrollView.native.js.map +1 -0
  36. package/dist/jsx/index.js +1 -2
  37. package/dist/jsx/index.mjs +1 -2
  38. package/dist/jsx/index.native.cjs +21 -0
  39. package/dist/jsx/index.native.js +10 -10
  40. package/dist/jsx/index.native.js.map +1 -1
  41. package/dist/jsx/web.mjs +3 -0
  42. package/package.json +13 -5
  43. package/src/ScrollView.native.tsx +21 -0
  44. package/src/ScrollView.tsx +5 -10
  45. package/src/WebScrollView.tsx +379 -0
  46. package/src/index.ts +1 -0
  47. package/src/web.ts +8 -0
  48. package/types/ScrollView.d.ts +50 -9
  49. package/types/ScrollView.d.ts.map +1 -1
  50. package/types/ScrollView.native.d.ts +53 -0
  51. package/types/ScrollView.native.d.ts.map +1 -0
  52. package/types/WebScrollView.d.ts +20 -0
  53. package/types/WebScrollView.d.ts.map +1 -0
  54. package/types/index.d.ts +1 -0
  55. package/types/index.d.ts.map +1 -1
  56. package/types/web.d.ts +4 -0
  57. package/types/web.d.ts.map +1 -0
  58. package/dist/esm/index.js.map +0 -1
  59. package/dist/esm/index.mjs.map +0 -1
  60. package/dist/esm/index.native.js.map +0 -1
  61. package/dist/jsx/index.js.map +0 -1
  62. package/dist/jsx/index.mjs.map +0 -1
@@ -1,43 +1,34 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var ScrollView_exports = {};
24
- __export(ScrollView_exports, {
25
- ScrollView: () => ScrollView
26
- });
23
+ __export(ScrollView_exports, { ScrollView: () => ScrollView });
27
24
  module.exports = __toCommonJS(ScrollView_exports);
28
- var import_stacks = require("@tamagui/stacks");
29
25
  var import_web = require("@tamagui/web");
30
- var import_react_native = require("react-native-web");
31
- const ScrollView = (0, import_web.styled)(import_react_native.ScrollView, {
32
- name: "ScrollView",
33
- scrollEnabled: true,
34
- variants: {
35
- fullscreen: {
36
- true: import_stacks.fullscreenStyle
37
- }
38
- }
26
+ var import_WebScrollView = require("./WebScrollView.cjs");
27
+ const ScrollView = (0, import_web.styled)(import_WebScrollView.WebScrollView, {
28
+ displayName: "ScrollView",
29
+ scrollEnabled: true
39
30
  }, {
40
- accept: {
41
- contentContainerStyle: "style"
42
- }
43
- });
31
+ acceptsClassName: true,
32
+ neverFlatten: true,
33
+ accept: { contentContainerStyle: "style" }
34
+ });
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var ScrollView_native_exports = {};
25
+ __export(ScrollView_native_exports, { ScrollView: () => ScrollView });
26
+ module.exports = __toCommonJS(ScrollView_native_exports);
27
+ var import_web = require("@tamagui/web");
28
+ var import_react_native = require("react-native");
29
+ var ScrollView = (0, import_web.styled)(import_react_native.ScrollView, {
30
+ displayName: "ScrollView",
31
+ scrollEnabled: true
32
+ }, {
33
+ neverFlatten: true,
34
+ accept: { contentContainerStyle: "style" }
35
+ });
@@ -1,46 +1,37 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
25
- var ScrollView_exports = {};
26
- __export(ScrollView_exports, {
27
- ScrollView: () => ScrollView
28
- });
29
- module.exports = __toCommonJS(ScrollView_exports);
30
- var import_stacks = require("@tamagui/stacks");
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var ScrollView_native_exports = {};
25
+ __export(ScrollView_native_exports, { ScrollView: () => ScrollView });
26
+ module.exports = __toCommonJS(ScrollView_native_exports);
31
27
  var import_web = require("@tamagui/web");
32
28
  var import_react_native = require("react-native");
33
29
  var ScrollView = (0, import_web.styled)(import_react_native.ScrollView, {
34
- name: "ScrollView",
35
- scrollEnabled: true,
36
- variants: {
37
- fullscreen: {
38
- true: import_stacks.fullscreenStyle
39
- }
40
- }
30
+ displayName: "ScrollView",
31
+ scrollEnabled: true
41
32
  }, {
42
- accept: {
43
- contentContainerStyle: "style"
44
- }
33
+ neverFlatten: true,
34
+ accept: { contentContainerStyle: "style" }
45
35
  });
36
+
46
37
  //# sourceMappingURL=ScrollView.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","ScrollView_exports","__export","ScrollView","module","exports","import_stacks","require","import_web","import_react_native","styled","name","scrollEnabled","variants","fullscreen","true","fullscreenStyle","accept","contentContainerStyle"],"sources":["../../src/ScrollView.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,kBAAA;AAAAC,QAAA,CAAAD,kBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAgC,CAAAK,kBAAA;AAEhC,IAAAK,aAAuB,GAAAC,OAAA;AACvB,IAAAC,UAAA,GAAAD,OAAA,eAA+C;AAExC,IAAAE,mBAAmB,GAAAF,OAAA;AAAA,IACxBJ,UAAA,OAAAK,UAAA,CAAAE,MAAA,EAAAD,mBAAA,CAAAN,UAAA;EACAQ,IAAA;EAAAC,aACQ;EAAAC,QACN;IAEAC,UAAU;MACRC,IAAA,EAAAT,aAAY,CAAAU;IAAA;EACJ;AACR;EAEJC,MAAA;IACAC,qBAAA;EAAA;AACU","ignoreList":[]}
1
+ {"version":3,"file":"ScrollView.native.js","names":[],"sources":["cjs/ScrollView.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar ScrollView_native_exports = {};\n__export(ScrollView_native_exports, {\n ScrollView: () => ScrollView\n});\nmodule.exports = __toCommonJS(ScrollView_native_exports);\nvar import_web = require(\"@tamagui/web\");\nvar import_react_native = require(\"react-native\");\nvar ScrollView = (0, import_web.styled)(import_react_native.ScrollView, {\n displayName: \"ScrollView\",\n scrollEnabled: true\n}, {\n neverFlatten: true,\n accept: {\n contentContainerStyle: \"style\"\n }\n});\n//# sourceMappingURL=ScrollView.native.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,4BAA4B,CAAC;AACjC,SAAS,2BAA2B,EAClC,kBAAkB,WACpB,CAAC;AACD,OAAO,UAAU,aAAa,yBAAyB;AACvD,IAAI,aAAa,QAAQ,cAAc;AACvC,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,cAAc,GAAG,WAAW,QAAQ,oBAAoB,YAAY;CACtE,aAAa;CACb,eAAe;AACjB,GAAG;CACD,cAAc;CACd,QAAQ,EACN,uBAAuB,QACzB;AACF,CAAC"}
@@ -0,0 +1,270 @@
1
+
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var WebScrollView_exports = {};
29
+ __export(WebScrollView_exports, { WebScrollView: () => WebScrollView });
30
+ module.exports = __toCommonJS(WebScrollView_exports);
31
+ var import_web = require("@tamagui/web");
32
+ var React = __toESM(require("react"), 1);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ const View = import_web.View;
35
+ function mergeRefs(...refs) {
36
+ return (node) => {
37
+ for (const ref of refs) {
38
+ if (!ref) continue;
39
+ if (typeof ref === "function") ref(node);
40
+ else ref.current = node;
41
+ }
42
+ };
43
+ }
44
+ function normalizeScrollEvent(e) {
45
+ const target = e.target;
46
+ return {
47
+ nativeEvent: {
48
+ contentOffset: {
49
+ get x() {
50
+ return target.scrollLeft;
51
+ },
52
+ get y() {
53
+ return target.scrollTop;
54
+ }
55
+ },
56
+ contentSize: {
57
+ get height() {
58
+ return target.scrollHeight;
59
+ },
60
+ get width() {
61
+ return target.scrollWidth;
62
+ }
63
+ },
64
+ layoutMeasurement: {
65
+ get height() {
66
+ return target.offsetHeight;
67
+ },
68
+ get width() {
69
+ return target.offsetWidth;
70
+ }
71
+ }
72
+ },
73
+ timeStamp: Date.now()
74
+ };
75
+ }
76
+ function shouldEmitScrollEvent(lastTick, eventThrottle) {
77
+ const timeSinceLastTick = Date.now() - lastTick;
78
+ return eventThrottle > 0 && timeSinceLastTick >= eventThrottle;
79
+ }
80
+ function resolveStyles(...inputs) {
81
+ const style = {};
82
+ const classNames = [];
83
+ const walk = (s) => {
84
+ if (!s) return;
85
+ if (Array.isArray(s)) {
86
+ for (const item of s) walk(item);
87
+ return;
88
+ }
89
+ if (s.$$css) {
90
+ for (const k in s) {
91
+ if (k !== "$$css") classNames.push(s[k]);
92
+ }
93
+ } else {
94
+ Object.assign(style, s);
95
+ }
96
+ };
97
+ for (const input of inputs) walk(input);
98
+ return {
99
+ style,
100
+ className: classNames.join(" ")
101
+ };
102
+ }
103
+ function joinClassNames(...parts) {
104
+ const joined = parts.filter(Boolean).join(" ").trim();
105
+ return joined || void 0;
106
+ }
107
+ const commonStyle = {
108
+ flexGrow: 1,
109
+ flexShrink: 1
110
+ };
111
+ const styles = {
112
+ baseVertical: {
113
+ ...commonStyle,
114
+ flexDirection: "column",
115
+ overflowX: "hidden",
116
+ overflowY: "auto"
117
+ },
118
+ baseHorizontal: {
119
+ ...commonStyle,
120
+ flexDirection: "row",
121
+ overflowX: "auto",
122
+ overflowY: "hidden"
123
+ },
124
+ contentContainerHorizontal: { flexDirection: "row" },
125
+ contentContainerCenterContent: {
126
+ justifyContent: "center",
127
+ flexGrow: 1
128
+ },
129
+ stickyHeader: {
130
+ position: "sticky",
131
+ top: 0,
132
+ zIndex: 10
133
+ },
134
+ pagingEnabledHorizontal: { scrollSnapType: "x mandatory" },
135
+ pagingEnabledVertical: { scrollSnapType: "y mandatory" },
136
+ pagingEnabledChild: { scrollSnapAlign: "start" },
137
+ scrollDisabled: {
138
+ overflowX: "hidden",
139
+ overflowY: "hidden",
140
+ touchAction: "none"
141
+ }
142
+ };
143
+ const WebScrollView = React.forwardRef((props, forwardedRef) => {
144
+ const { children, contentContainerStyle, horizontal, onContentSizeChange, onScroll, refreshControl, stickyHeaderIndices, pagingEnabled, centerContent, scrollEnabled = true, scrollEventThrottle = 0, showsHorizontalScrollIndicator, showsVerticalScrollIndicator, style, keyboardShouldPersistTaps, keyboardDismissMode, contentOffset, contentInset, contentInsetAdjustmentBehavior, decelerationRate, directionalLockEnabled, disableIntervalMomentum, disableScrollViewPanResponder, endFillColor, fadingEdgeLength, indicatorStyle, invertStickyHeaders, maintainVisibleContentPosition, maximumZoomScale, minimumZoomScale, nestedScrollEnabled, onScrollToTop, overScrollMode, pinchGestureEnabled, removeClippedSubviews, scrollIndicatorInsets, scrollPerfTag, scrollToOverflowEnabled, snapToAlignment, snapToEnd, snapToInterval, snapToOffsets, snapToStart, bounces, ...rest } = props;
145
+ const { dataSet, ...domRest } = rest;
146
+ const dataAttrs = {};
147
+ if (dataSet) {
148
+ for (const key in dataSet) {
149
+ dataAttrs[`data-${key}`] = dataSet[key];
150
+ }
151
+ }
152
+ const scrollNodeRef = React.useRef(null);
153
+ const innerViewRef = React.useRef(null);
154
+ const scrollState = React.useRef({
155
+ isScrolling: false,
156
+ scrollLastTick: 0
157
+ });
158
+ const scrollTimeout = React.useRef(null);
159
+ const scrollTo = (options) => {
160
+ const node = scrollNodeRef.current;
161
+ if (node == null) return;
162
+ const { x = 0, y = 0, animated = true } = options || {};
163
+ if (typeof node.scroll === "function") {
164
+ node.scroll({
165
+ top: y,
166
+ left: x,
167
+ behavior: animated ? "smooth" : "auto"
168
+ });
169
+ } else {
170
+ node.scrollLeft = x;
171
+ node.scrollTop = y;
172
+ }
173
+ };
174
+ const scrollToEnd = (options) => {
175
+ const node = scrollNodeRef.current;
176
+ if (node == null) return;
177
+ const animated = (options && options.animated) !== false;
178
+ const x = horizontal ? node.scrollWidth : 0;
179
+ const y = horizontal ? 0 : node.scrollHeight;
180
+ scrollTo({
181
+ x,
182
+ y,
183
+ animated
184
+ });
185
+ };
186
+ const setScrollNodeRef = React.useCallback((node) => {
187
+ scrollNodeRef.current = node;
188
+ if (node != null) {
189
+ node.getScrollResponder = () => node;
190
+ node.getScrollableNode = () => node;
191
+ node.getInnerViewNode = () => innerViewRef.current;
192
+ node.getInnerViewRef = () => innerViewRef.current;
193
+ node.getNativeScrollRef = () => node;
194
+ node.scrollTo = scrollTo;
195
+ node.scrollToEnd = scrollToEnd;
196
+ node.flashScrollIndicators = () => {};
197
+ }
198
+ mergeRefs(forwardedRef)(node);
199
+ }, [forwardedRef, horizontal]);
200
+ function handleScroll(e) {
201
+ e.stopPropagation();
202
+ if (e.target !== scrollNodeRef.current) return;
203
+ if (scrollTimeout.current != null) {
204
+ clearTimeout(scrollTimeout.current);
205
+ }
206
+ scrollTimeout.current = setTimeout(() => {
207
+ scrollState.current.isScrolling = false;
208
+ onScroll?.(normalizeScrollEvent(e));
209
+ }, 100);
210
+ if (scrollState.current.isScrolling) {
211
+ if (shouldEmitScrollEvent(scrollState.current.scrollLastTick, scrollEventThrottle)) {
212
+ scrollState.current.scrollLastTick = Date.now();
213
+ onScroll?.(normalizeScrollEvent(e));
214
+ }
215
+ } else {
216
+ scrollState.current.isScrolling = true;
217
+ scrollState.current.scrollLastTick = Date.now();
218
+ onScroll?.(normalizeScrollEvent(e));
219
+ }
220
+ }
221
+ const handleContentLayout = onContentSizeChange ? (e) => {
222
+ const { width, height } = e.nativeEvent.layout;
223
+ onContentSizeChange(width, height);
224
+ } : void 0;
225
+ const hasStickyHeaderIndices = !horizontal && Array.isArray(stickyHeaderIndices);
226
+ const renderedChildren = hasStickyHeaderIndices || pagingEnabled ? React.Children.map(children, (child, i) => {
227
+ const isSticky = hasStickyHeaderIndices && stickyHeaderIndices.indexOf(i) > -1;
228
+ if (child != null && (isSticky || pagingEnabled)) {
229
+ const resolved = resolveStyles(isSticky && styles.stickyHeader, pagingEnabled && styles.pagingEnabledChild);
230
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
231
+ style: resolved.style,
232
+ className: joinClassNames(resolved.className),
233
+ children: child
234
+ });
235
+ }
236
+ return child;
237
+ }) : children;
238
+ const contentResolved = resolveStyles(horizontal && styles.contentContainerHorizontal, centerContent && styles.contentContainerCenterContent, contentContainerStyle);
239
+ const contentContainer = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
240
+ ref: innerViewRef,
241
+ onLayout: handleContentLayout,
242
+ style: contentResolved.style,
243
+ className: joinClassNames(contentResolved.className),
244
+ children: renderedChildren
245
+ });
246
+ const baseStyle = horizontal ? styles.baseHorizontal : styles.baseVertical;
247
+ const pagingEnabledStyle = horizontal ? styles.pagingEnabledHorizontal : styles.pagingEnabledVertical;
248
+ const hideHorizontalScrollbar = showsHorizontalScrollIndicator === false;
249
+ const hideVerticalScrollbar = showsVerticalScrollIndicator === false;
250
+ const extraClassName = (hideHorizontalScrollbar ? " _hsb-x" : "") + (hideVerticalScrollbar ? " _hsb-y" : "");
251
+ const scrollResolved = resolveStyles(baseStyle, pagingEnabled && pagingEnabledStyle, style, !scrollEnabled && styles.scrollDisabled);
252
+ const scrollView = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
253
+ ...domRest,
254
+ ...dataAttrs,
255
+ className: joinClassNames(domRest.className, scrollResolved.className, extraClassName),
256
+ ref: setScrollNodeRef,
257
+ onScroll: handleScroll,
258
+ style: scrollResolved.style,
259
+ children: contentContainer
260
+ });
261
+ if (refreshControl) {
262
+ const refreshResolved = resolveStyles(baseStyle, style);
263
+ return React.cloneElement(refreshControl, {
264
+ style: refreshResolved.style,
265
+ className: joinClassNames(refreshResolved.className)
266
+ }, scrollView);
267
+ }
268
+ return scrollView;
269
+ });
270
+ WebScrollView.displayName = "ScrollView";