@lynx-js/lynx-ui-scroll-view 3.135.3 → 3.136.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @lynx-js/lynx-ui-scroll-view
2
2
 
3
+ ## 3.136.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0257f8b`](https://github.com/lynx-family/lynx-ui/commit/0257f8bc9fbe6b8a51df00663c7860827ce468b2), [`64e2795`](https://github.com/lynx-family/lynx-ui/commit/64e2795c6cff3d53fd0f616d67d1f5eecb9956e9)]:
8
+ - @lynx-js/lynx-ui-common@3.136.0
9
+ - @lynx-js/lynx-ui-lazy-component@3.136.0
10
+
11
+ ## 3.135.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Upgrade the Lynx and Rsbuild toolchain dependencies used to build lynx-ui packages. ([#233](https://github.com/lynx-family/lynx-ui/pull/233))
16
+
17
+ - Updated dependencies [[`753556b`](https://github.com/lynx-family/lynx-ui/commit/753556bc1acb77e05567aba3b8b5ab057b9f670b)]:
18
+ - @lynx-js/lynx-ui-common@3.135.4
19
+ - @lynx-js/lynx-ui-lazy-component@3.135.4
20
+
3
21
  ## 3.135.3
4
22
 
5
23
  ### Patch Changes
@@ -6,6 +6,6 @@ function ScrollViewBasic(props) {
6
6
  </scroll-view>;
7
7
  }
8
8
  const src_ScrollViewBasic = ScrollViewBasic;
9
- export { src_ScrollViewBasic as default };
9
+ export default src_ScrollViewBasic;
10
10
 
11
11
  //# sourceMappingURL=ScrollViewBasic.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollViewBasic.jsx","sources":["webpack://@lynx-js/lynx-ui-scroll-view/./src/ScrollViewBasic.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement, ReactNode } from '@lynx-js/react'\n\nimport type { ScrollViewProps as ScrollViewElementProps } from '@lynx-js/types'\n\nfunction ScrollViewBasic(\n props: {\n elementProps: ScrollViewElementProps\n children?: ReactNode\n sticky?: ReactElement\n },\n) {\n const { children, sticky, elementProps } = props\n\n return (\n <scroll-view\n {...elementProps}\n android-touch-slop='page'\n // This is a workaround for using RL3.0-ver 0.110.1 and SDK-ver <=3.4. It will force the scroll-view to update after the BTS is ready and flush the 'name' prop along with __AddEvents. Otherwise, a pure __AddEvents will be discarded by the engine and won't trigger the flush of the prop_bundle. As a result, all events will be lost.\n // We do not use __MAIN_THREAD__ here to maintain compatibility with the old version of @lynx-js/react.\n name={__LEPUS__ ? 'lepus' : 'background'}\n >\n {sticky}\n {children}\n </scroll-view>\n )\n}\n\nexport default ScrollViewBasic\n"],"names":["ScrollViewBasic","props","children","sticky","elementProps","scroll-view","__LEPUS__"],"mappings":"AAQA,SAASA,gBACPC,KAIC;IAED,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAE,GAAGH;IAE3C,QACGI,aACE,GAAGD,YAAY,EAChB,mBAAmB,OAGnB,MAAME,YAAY,UAAU,cAC7B;MACC,CAACH,OAAO;MACR,CAACD,SAAS;IACZ,EAAEG;AAEN;AAEA,4BAAeL"}
1
+ {"version":3,"file":"ScrollViewBasic.jsx","sources":["../src/ScrollViewBasic.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement, ReactNode } from '@lynx-js/react'\n\nimport type { ScrollViewProps as ScrollViewElementProps } from '@lynx-js/types'\n\nfunction ScrollViewBasic(\n props: {\n elementProps: ScrollViewElementProps\n children?: ReactNode\n sticky?: ReactElement\n },\n) {\n const { children, sticky, elementProps } = props\n\n return (\n <scroll-view\n {...elementProps}\n android-touch-slop='page'\n // This is a workaround for using RL3.0-ver 0.110.1 and SDK-ver <=3.4. It will force the scroll-view to update after the BTS is ready and flush the 'name' prop along with __AddEvents. Otherwise, a pure __AddEvents will be discarded by the engine and won't trigger the flush of the prop_bundle. As a result, all events will be lost.\n // We do not use __MAIN_THREAD__ here to maintain compatibility with the old version of @lynx-js/react.\n name={__LEPUS__ ? 'lepus' : 'background'}\n >\n {sticky}\n {children}\n </scroll-view>\n )\n}\n\nexport default ScrollViewBasic\n"],"names":["ScrollViewBasic","props","children","sticky","elementProps","scroll-view","__LEPUS__"],"mappings":"AAQA,SAASA,gBACPC,KAIC;IAED,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAE,GAAGH;IAE3C,QACGI,aACE,GAAGD,YAAY,EAChB,mBAAmB,OAGnB,MAAME,YAAY,UAAU,cAC7B;MACC,CAACH,OAAO;MACR,CAACD,SAAS;IACZ,EAAEG;AAEN;AAEA,4BAAeL"}
@@ -54,6 +54,6 @@ function ScrollViewWithBouncesHook(props, _ref) {
54
54
  </view>;
55
55
  }
56
56
  const src_ScrollViewWithBouncesHook = ScrollViewWithBouncesHook;
57
- export { src_ScrollViewWithBouncesHook as default };
57
+ export default src_ScrollViewWithBouncesHook;
58
58
 
59
59
  //# sourceMappingURL=ScrollViewWithBouncesHook.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollViewWithBouncesHook.jsx","sources":["webpack://@lynx-js/lynx-ui-scroll-view/./src/ScrollViewWithBouncesHook.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ForwardedRef, ReactElement, ReactNode } from '@lynx-js/react'\n\nimport '@lynx-js/gesture-runtime'\nimport type {\n CSSProperties,\n ScrollViewProps as ScrollViewElementProps,\n} from '@lynx-js/types'\n\nimport { useBounce } from './hooks/useBounce'\nimport type {\n BounceableBasicProps,\n ScrollViewProps,\n ScrollViewRef,\n} from './types'\n\nexport type { ScrollViewProps, ScrollViewRef }\n\nfunction ScrollViewWithBouncesHook(\n props: {\n elementProps: ScrollViewElementProps\n children?: ReactNode\n bounceableOptions?: BounceableBasicProps\n debugLog?: boolean\n enableRTL?: boolean\n sticky?: ReactElement\n },\n _ref: ForwardedRef<ScrollViewRef>,\n) {\n const {\n children,\n bounceableOptions,\n sticky,\n elementProps,\n debugLog = false,\n enableRTL = false,\n } = props\n // @ts-expect-error Compatible with older versions\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const horizontal = elementProps['scroll-x']\n // @ts-expect-error Compatible with older versions\n ?? elementProps['scroll-y'] === false\n const scrollViewId = elementProps.id\n const { style } = elementProps as { style: CSSProperties }\n // Initialize bounceableProps\n let enableBounce = false\n let bounceableProps: BounceableBasicProps = { enableBounces: false }\n let startBounceView, endBounceView, upperExposureView, lowerExposureView\n if (typeof bounceableOptions === 'boolean') {\n enableBounce = bounceableOptions\n bounceableProps = {\n enableBounces: true,\n singleSidedBounce: 'both',\n alwaysBouncing: true,\n validAnimationVersion: true,\n }\n } else if (typeof bounceableOptions === 'object') {\n enableBounce = bounceableOptions.enableBounces\n bounceableProps = bounceableOptions\n bounceableProps.singleSidedBounce = bounceableOptions.singleSidedBounce\n ?? 'both'\n bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true\n bounceableProps.validAnimationVersion =\n bounceableOptions.validAnimationVersion ?? true\n }\n const bounceMTSProps = useBounce({\n bounceableOptions: bounceableProps,\n debugLog,\n enableRTL,\n id: scrollViewId,\n scrollOrientation: horizontal ? 'horizontal' : 'vertical',\n })\n if (enableBounce) {\n if (bounceableProps.upperBounceItem) {\n startBounceView = (\n <view\n id={`${scrollViewId}-upperBounceWrapper`}\n style={`position:absolute;${\n horizontal\n ? (enableRTL ? 'left:100%' : 'right:100%')\n : 'bottom:100%'\n }; ${horizontal ? 'height:100%;' : 'width:100%;'};${\n horizontal ? 'width:max-content' : 'height:max-content'\n };`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n {bounceableProps.upperBounceItem}\n </view>\n )\n }\n if (bounceableProps.lowerBounceItem) {\n endBounceView = (\n <view\n id={`${scrollViewId}-lowerBounceWrapper`}\n style={`position:absolute;${\n horizontal\n ? (enableRTL ? 'right:100%' : 'left:100%')\n : 'top:100%'\n }; ${horizontal ? 'height:100%;' : 'width:100%;'};${\n horizontal ? 'width:max-content' : 'height:max-content'\n };`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n {bounceableProps.lowerBounceItem}\n </view>\n )\n }\n upperExposureView = (\n <view\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : '1ppx'\n }; width: ${horizontal ? '1ppx' : '100%'};`}\n exposure-scene={scrollViewId}\n exposure-id='upperExposureView'\n id={`${scrollViewId}-upperExposureView`}\n main-thread:binduidisappear={bounceMTSProps.onUpperDisexposure}\n main-thread:binduiappear={bounceMTSProps.onUpperExposure}\n main-thread:gesture={elementProps['main-thread:gesture']}\n />\n )\n lowerExposureView = (\n <view\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : '1ppx'\n }; width: ${horizontal ? '1ppx' : '100%'};`}\n exposure-scene={scrollViewId}\n exposure-id='lowerExposureView'\n id={`${scrollViewId}-lowerExposureView`}\n main-thread:binduidisappear={bounceMTSProps.onLowerDisexposure}\n main-thread:binduiappear={bounceMTSProps.onLowerExposure}\n main-thread:gesture={elementProps['main-thread:gesture']}\n />\n )\n }\n\n return (\n <view\n id={`${scrollViewId}-BounceWrapper`}\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : `${style?.height}`\n }; width: ${horizontal ? `${style?.width}` : '100%'};`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n <scroll-view\n {...elementProps}\n {...bounceMTSProps}\n bounces={false}\n ios-enable-simultaneous-touch={true}\n // This is a workaround for using RL3.0-ver 0.110.1 and SDK-ver <=3.4. It will force the scroll-view to update after the BTS is ready and flush the 'name' prop along with __AddEvents. Otherwise, a pure __AddEvents will be discarded by the engine and won't trigger the flush of the prop_bundle. As a result, all events will be lost.\n // We do not use __MAIN_THREAD__ here to maintain compatibility with the old version of @lynx-js/react.\n name={__LEPUS__ ? 'lepus' : 'background'}\n >\n {upperExposureView}\n {sticky}\n {children}\n {lowerExposureView}\n </scroll-view>\n {startBounceView}\n {endBounceView}\n </view>\n )\n}\n\nexport default ScrollViewWithBouncesHook\n"],"names":["ScrollViewWithBouncesHook","props","_ref","children","bounceableOptions","sticky","elementProps","debugLog","enableRTL","horizontal","scrollViewId","style","enableBounce","bounceableProps","startBounceView","endBounceView","upperExposureView","lowerExposureView","bounceMTSProps","useBounce","view","scroll-view","__LEPUS__"],"mappings":";;AAqBA,SAASA,0BACPC,KAOC,EACDC,IAAiC;IAEjC,MAAM,EACJC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,YAAY,EACZC,WAAW,KAAK,EAChBC,YAAY,KAAK,EAClB,GAAGP;IAGJ,MAAMQ,aAAaH,YAAY,CAAC,WAAW,IAEtCA,AAA6B,UAA7BA,YAAY,CAAC,WAAW;IAC7B,MAAMI,eAAeJ,aAAa,EAAE;IACpC,MAAM,EAAEK,KAAK,EAAE,GAAGL;IAElB,IAAIM,eAAe;IACnB,IAAIC,kBAAwC;QAAE,eAAe;IAAM;IACnE,IAAIC,iBAAiBC,eAAeC,mBAAmBC;IACvD,IAAI,AAA6B,aAA7B,OAAOb,mBAAiC;QAC1CQ,eAAeR;QACfS,kBAAkB;YAChB,eAAe;YACf,mBAAmB;YACnB,gBAAgB;YAChB,uBAAuB;QACzB;IACF,OAAO,IAAI,AAA6B,YAA7B,OAAOT,mBAAgC;QAChDQ,eAAeR,kBAAkB,aAAa;QAC9CS,kBAAkBT;QAClBS,gBAAgB,iBAAiB,GAAGT,kBAAkB,iBAAiB,IAClE;QACLS,gBAAgB,cAAc,GAAGT,kBAAkB,cAAc,IAAI;QACrES,gBAAgB,qBAAqB,GACnCT,kBAAkB,qBAAqB,IAAI;IAC/C;I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BQ,eAAe,kBAAkB,EAC9D,YAAY,cAAcA,eAAe,eAAe,EACxD,YAAY,SAASZ,YAAY,CAAC,sBAAsB;IAG9D;IAEA,QACGc,KACC,IAAI,GAAGV,aAAa,cAAc,CAAC,EACnC,OAAO,CAAC,gEAAgE,EACtED,aAAa,SAAS,GAAGE,OAAO,QAAQ,CACzC,SAAS,EAAEF,aAAa,GAAGE,OAAO,OAAO,GAAG,OAAO,CAAC,CAAC,EACtD,YAAY,SAASL,YAAY,CAAC,sBAAsB,EACzD;MACC,CAACe,aACE,GAAGf,YAAY,GACf,GAAGY,cAAc,EAClB,SAAS,OACT,+BAA+B,MAG/B,MAAMI,YAAY,UAAU,cAC7B;QACC,CAACN,kBAAkB;QACnB,CAACX,OAAO;QACR,CAACF,SAAS;QACV,CAACc,kBAAkB;MACrB,EAAEI,YAAY;MACd,CAACP,gBAAgB;MACjB,CAACC,cAAc;IACjB,EAAEK;AAEN;AAEA,sCAAepB"}
1
+ {"version":3,"file":"ScrollViewWithBouncesHook.jsx","sources":["../src/ScrollViewWithBouncesHook.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ForwardedRef, ReactElement, ReactNode } from '@lynx-js/react'\n\nimport '@lynx-js/gesture-runtime'\nimport type {\n CSSProperties,\n ScrollViewProps as ScrollViewElementProps,\n} from '@lynx-js/types'\n\nimport { useBounce } from './hooks/useBounce'\nimport type {\n BounceableBasicProps,\n ScrollViewProps,\n ScrollViewRef,\n} from './types'\n\nexport type { ScrollViewProps, ScrollViewRef }\n\nfunction ScrollViewWithBouncesHook(\n props: {\n elementProps: ScrollViewElementProps\n children?: ReactNode\n bounceableOptions?: BounceableBasicProps\n debugLog?: boolean\n enableRTL?: boolean\n sticky?: ReactElement\n },\n _ref: ForwardedRef<ScrollViewRef>,\n) {\n const {\n children,\n bounceableOptions,\n sticky,\n elementProps,\n debugLog = false,\n enableRTL = false,\n } = props\n // @ts-expect-error Compatible with older versions\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const horizontal = elementProps['scroll-x']\n // @ts-expect-error Compatible with older versions\n ?? elementProps['scroll-y'] === false\n const scrollViewId = elementProps.id\n const { style } = elementProps as { style: CSSProperties }\n // Initialize bounceableProps\n let enableBounce = false\n let bounceableProps: BounceableBasicProps = { enableBounces: false }\n let startBounceView, endBounceView, upperExposureView, lowerExposureView\n if (typeof bounceableOptions === 'boolean') {\n enableBounce = bounceableOptions\n bounceableProps = {\n enableBounces: true,\n singleSidedBounce: 'both',\n alwaysBouncing: true,\n validAnimationVersion: true,\n }\n } else if (typeof bounceableOptions === 'object') {\n enableBounce = bounceableOptions.enableBounces\n bounceableProps = bounceableOptions\n bounceableProps.singleSidedBounce = bounceableOptions.singleSidedBounce\n ?? 'both'\n bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true\n bounceableProps.validAnimationVersion =\n bounceableOptions.validAnimationVersion ?? true\n }\n const bounceMTSProps = useBounce({\n bounceableOptions: bounceableProps,\n debugLog,\n enableRTL,\n id: scrollViewId,\n scrollOrientation: horizontal ? 'horizontal' : 'vertical',\n })\n if (enableBounce) {\n if (bounceableProps.upperBounceItem) {\n startBounceView = (\n <view\n id={`${scrollViewId}-upperBounceWrapper`}\n style={`position:absolute;${\n horizontal\n ? (enableRTL ? 'left:100%' : 'right:100%')\n : 'bottom:100%'\n }; ${horizontal ? 'height:100%;' : 'width:100%;'};${\n horizontal ? 'width:max-content' : 'height:max-content'\n };`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n {bounceableProps.upperBounceItem}\n </view>\n )\n }\n if (bounceableProps.lowerBounceItem) {\n endBounceView = (\n <view\n id={`${scrollViewId}-lowerBounceWrapper`}\n style={`position:absolute;${\n horizontal\n ? (enableRTL ? 'right:100%' : 'left:100%')\n : 'top:100%'\n }; ${horizontal ? 'height:100%;' : 'width:100%;'};${\n horizontal ? 'width:max-content' : 'height:max-content'\n };`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n {bounceableProps.lowerBounceItem}\n </view>\n )\n }\n upperExposureView = (\n <view\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : '1ppx'\n }; width: ${horizontal ? '1ppx' : '100%'};`}\n exposure-scene={scrollViewId}\n exposure-id='upperExposureView'\n id={`${scrollViewId}-upperExposureView`}\n main-thread:binduidisappear={bounceMTSProps.onUpperDisexposure}\n main-thread:binduiappear={bounceMTSProps.onUpperExposure}\n main-thread:gesture={elementProps['main-thread:gesture']}\n />\n )\n lowerExposureView = (\n <view\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : '1ppx'\n }; width: ${horizontal ? '1ppx' : '100%'};`}\n exposure-scene={scrollViewId}\n exposure-id='lowerExposureView'\n id={`${scrollViewId}-lowerExposureView`}\n main-thread:binduidisappear={bounceMTSProps.onLowerDisexposure}\n main-thread:binduiappear={bounceMTSProps.onLowerExposure}\n main-thread:gesture={elementProps['main-thread:gesture']}\n />\n )\n }\n\n return (\n <view\n id={`${scrollViewId}-BounceWrapper`}\n style={`display: flex; flex-direction: column; overflow:hidden; height: ${\n horizontal ? '100%' : `${style?.height}`\n }; width: ${horizontal ? `${style?.width}` : '100%'};`}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n <scroll-view\n {...elementProps}\n {...bounceMTSProps}\n bounces={false}\n ios-enable-simultaneous-touch={true}\n // This is a workaround for using RL3.0-ver 0.110.1 and SDK-ver <=3.4. It will force the scroll-view to update after the BTS is ready and flush the 'name' prop along with __AddEvents. Otherwise, a pure __AddEvents will be discarded by the engine and won't trigger the flush of the prop_bundle. As a result, all events will be lost.\n // We do not use __MAIN_THREAD__ here to maintain compatibility with the old version of @lynx-js/react.\n name={__LEPUS__ ? 'lepus' : 'background'}\n >\n {upperExposureView}\n {sticky}\n {children}\n {lowerExposureView}\n </scroll-view>\n {startBounceView}\n {endBounceView}\n </view>\n )\n}\n\nexport default ScrollViewWithBouncesHook\n"],"names":["ScrollViewWithBouncesHook","props","_ref","children","bounceableOptions","sticky","elementProps","debugLog","enableRTL","horizontal","scrollViewId","style","enableBounce","bounceableProps","startBounceView","endBounceView","upperExposureView","lowerExposureView","bounceMTSProps","useBounce","view","scroll-view","__LEPUS__"],"mappings":";;AAqBA,SAASA,0BACPC,KAOC,EACDC,IAAiC;IAEjC,MAAM,EACJC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,YAAY,EACZC,WAAW,KAAK,EAChBC,YAAY,KAAK,EAClB,GAAGP;IAGJ,MAAMQ,aAAaH,YAAY,CAAC,WAAW,IAEtCA,AAA6B,UAA7BA,YAAY,CAAC,WAAW;IAC7B,MAAMI,eAAeJ,aAAa,EAAE;IACpC,MAAM,EAAEK,KAAK,EAAE,GAAGL;IAElB,IAAIM,eAAe;IACnB,IAAIC,kBAAwC;QAAE,eAAe;IAAM;IACnE,IAAIC,iBAAiBC,eAAeC,mBAAmBC;IACvD,IAAI,AAA6B,aAA7B,OAAOb,mBAAiC;QAC1CQ,eAAeR;QACfS,kBAAkB;YAChB,eAAe;YACf,mBAAmB;YACnB,gBAAgB;YAChB,uBAAuB;QACzB;IACF,OAAO,IAAI,AAA6B,YAA7B,OAAOT,mBAAgC;QAChDQ,eAAeR,kBAAkB,aAAa;QAC9CS,kBAAkBT;QAClBS,gBAAgB,iBAAiB,GAAGT,kBAAkB,iBAAiB,IAClE;QACLS,gBAAgB,cAAc,GAAGT,kBAAkB,cAAc,IAAI;QACrES,gBAAgB,qBAAqB,GACnCT,kBAAkB,qBAAqB,IAAI;IAC/C;IACA,MAAMc,iBAAiBC,UAAU;QAC/B,mBAAmBN;QACnBN;QACAC;QACA,IAAIE;QACJ,mBAAmBD,aAAa,eAAe;IACjD;IACA,IAAIG,cAAc;QAChB,IAAIC,gBAAgB,eAAe,EACjCC,mBACGM,KACC,IAAI,GAAGV,aAAa,mBAAmB,CAAC,EACxC,OAAO,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ACzC,SAAS,EAAEF,aAAa,GAAGE,OAAO,OAAO,GAAG,OAAO,CAAC,CAAC,EACtD,YAAY,SAASL,YAAY,CAAC,sBAAsB,EACzD;MACC,CAACe,aACE,GAAGf,YAAY,GACf,GAAGY,cAAc,EAClB,SAAS,OACT,+BAA+B,MAG/B,MAAMI,YAAY,UAAU,cAC7B;QACC,CAACN,kBAAkB;QACnB,CAACX,OAAO;QACR,CAACF,SAAS;QACV,CAACc,kBAAkB;MACrB,EAAEI,YAAY;MACd,CAACP,gBAAgB;MACjB,CAACC,cAAc;IACjB,EAAEK;AAEN;AAEA,sCAAepB"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks/useBounce.jsx","sources":["webpack://@lynx-js/lynx-ui-scroll-view/./src/hooks/useBounce.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { runOnBackground, useMainThreadRef } from '@lynx-js/react'\n\nimport { log, mtsLog, selectorMT } from '@lynx-js/lynx-ui-common'\nimport type { CommonEvent, MainThread, ScrollEvent } from '@lynx-js/types'\n\nexport interface scrollToBouncesInfo {\n direction: 'upper' | 'lower'\n}\n\nexport interface BounceableBasicProps {\n enableBounces: boolean\n enableBounceEventInFling?: boolean\n startBounceTriggerDistance?: number\n endBounceTriggerDistance?: number\n // biome-ignore lint/suspicious/noExplicitAny: expected\n upperBounceItem?: any\n // biome-ignore lint/suspicious/noExplicitAny: expected\n lowerBounceItem?: any\n alwaysBouncing?: boolean\n singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'\n estimatedHeight?: number\n estimatedWidth?: number\n validAnimationVersion?: boolean\n onScrollToBounces?: (e: scrollToBouncesInfo) => void\n}\n\nexport interface useBounceOptions {\n bounceableOptions: BounceableBasicProps\n debugLog?: boolean\n enableRTL?: boolean\n /**\n * idSelector of scroll container\n */\n id?: string\n /**\n * scroll direction\n */\n scrollOrientation: 'vertical' | 'horizontal'\n}\n\nexport interface bounceHandlers {\n 'main-thread:bindtouchstart': (event: MainThread.TouchEvent) => void\n 'main-thread:bindtouchend': () => void\n 'main-thread:bindtouchmove': (event: MainThread.TouchEvent) => void\n 'main-thread:bindlayoutchange': (event: CommonEvent) => void\n 'main-thread:bindscroll': (event: ScrollEvent) => void\n onUpperExposure: (_event: CommonEvent) => void\n onUpperDisexposure: (_event: CommonEvent) => void\n onLowerExposure: (_event: CommonEvent) => void\n onLowerDisexposure: (_event: CommonEvent) => void\n}\n\nexport function useBounce(options: useBounceOptions): bounceHandlers {\n // Control the damping coefficient during rubber effect. The smaller it is, the harder the spring effect.\n const rubberC = useMainThreadRef(0.55)\n // Control the fling deceleration coefficient during dropdown. The smaller it is, the faster it stops.\n const flingDeceleratingRate = useMainThreadRef(0.99)\n // The rebound coefficient during bounce back, the larger it is, the faster the rebound speed.\n const beta = useMainThreadRef(15)\n\n const debugLogEnabled = Boolean(options.debugLog)\n\n const singleSidedBounce = useMainThreadRef(\n options.bounceableOptions.singleSidedBounce ?? 'both',\n )\n\n // The starting point of current touch procedure\n const startTouch = useMainThreadRef<MainThread.TouchEvent['touches'] | null>(\n null,\n )\n // Record the previous touch and clear it on touchEnd. If current is not empty, then it means that the scrollable object is being dragged.\n const prevTouch = useMainThreadRef<MainThread.TouchEvent['touches'] | null>(\n null,\n )\n\n // Current scroll velocity.\n const scrollVelocity = useMainThreadRef(0)\n // Current bouncing position.\n const bouncingPositionInfo = useMainThreadRef({})\n\n // If reaches edge and bouncing starts during dragging, save the touch point and calculate later touch delta for rubberEffect.\n const startBouncingTouch = useMainThreadRef<\n MainThread.TouchEvent['touches'] | null\n >(null)\n // If reaches edge and bouncing starts during dragging, save current bouncingPosition and continues rubberEffect's calculation from this point.\n const startTouchBouncingDelta = useMainThreadRef({})\n // when touch starts during bouncing, save current bouncingPosition and continues rubberEffect's calculation from this point.\n const bouncingTouchStartPosition = useMainThreadRef({})\n\n // Used to record the previous scroll position and calculate current scroll velocity.\n const prevScroll = useMainThreadRef({})\n\n // scroll container's basic info.\n const height = useMainThreadRef(\n options.bounceableOptions.estimatedHeight\n ?? SystemInfo.pixelHeight / SystemInfo.pixelRatio,\n )\n const width = useMainThreadRef(\n options.bounceableOptions.estimatedWidth\n ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio,\n )\n const scrollX = useMainThreadRef(0)\n const scrollY = useMainThreadRef(0)\n\n // Flags for ending bouncing animation.\n const touchEndFrameEnableFlag = useMainThreadRef(false)\n const touchingEndBouncingBackEnableFlag = useMainThreadRef(false)\n const flingEndWithBouncingEnableFlag = useMainThreadRef(false)\n\n // Flags for reaches upper/lower edge.\n // When content's size is smaller than viewport, these two flags are both true.\n const toUpper = useMainThreadRef(false)\n const toLower = useMainThreadRef(false)\n\n // Read from props\n const containerID = options.id ?? 'bounceableContainer'\n const { enableBounces, onScrollToBounces } = options.bounceableOptions\n const alwaysBouncing = options.bounceableOptions.alwaysBouncing ?? false\n const scrollOrientation = options.scrollOrientation ?? 'vertical'\n const enableRTL = useMainThreadRef(options.enableRTL ?? false)\n const enableBounceEventInFling =\n options.bounceableOptions.enableBounceEventInFling ?? true\n const startBounceTriggerDistance =\n options.bounceableOptions.startBounceTriggerDistance ?? 0\n const endBounceTriggerDistance =\n options.bounceableOptions.endBounceTriggerDistance ?? 0\n // Temporary workaround as requestAnimationFrame will crash below Lynx 2.15.2.\n const temporaryValidVersionCheckForRAF = useMainThreadRef(\n options.bounceableOptions.validAnimationVersion ?? false,\n )\n log(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] init, enableBounces: ${enableBounces}, orientation: ${scrollOrientation}, enableRTL: ${\n options.enableRTL ?? false\n }`,\n )\n\n const bouncingStatus = {\n inScrollingRange: 0,\n upperBouncing: 1,\n lowerBouncing: 2,\n noBouncing: 3,\n alwaysBouncing: 4,\n }\n\n function isVertical() {\n 'main thread'\n return scrollOrientation === 'vertical'\n }\n\n function threshold() {\n 'main thread'\n return 1.0 / Number(SystemInfo.pixelRatio)\n }\n\n function normalizedHorizontalValue(value: number) {\n 'main thread'\n return enableRTL.current ? -value : value\n }\n\n function isAndroid() {\n 'main thread'\n return SystemInfo.platform === 'Android'\n }\n\n function isEmpty(obj: Record<string, unknown>) {\n 'main thread'\n return !obj || Object.keys(obj).length === 0\n }\n\n function enableScroll(enable: boolean) {\n 'main thread'\n // Android will trigger scroll during bouncing, cancel it while bouncing.\n if (isAndroid()) {\n selectorMT(containerID)?.setAttribute('enable-scroll', enable)\n }\n }\n\n // Clear all temps when a touch procedure ends.\n function clearTouchInfo() {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] clear touch info')\n startTouch.current = null\n bouncingTouchStartPosition.current = 0\n prevTouch.current = null\n startBouncingTouch.current = null\n startTouchBouncingDelta.current = 0\n }\n\n // Temporary workaround as requestAnimationFrame will crash below Lynx 2.15.2.\n function customRequestAnimationFrame(animationFunc: () => void) {\n 'main thread'\n if (temporaryValidVersionCheckForRAF.current) {\n requestAnimationFrame(animationFunc)\n } else {\n setTimeout(animationFunc, 8)\n }\n }\n\n // Calculate current touch delta based on 'startPoint'. The startPoint here should be startBouncingTouch which means this bouncing effect happens during a touch procedure.\n function getCurrentDelta(event: MainThread.TouchEvent) {\n 'main thread'\n if (startTouch.current !== null) {\n if (startBouncingTouch.current === null) {\n return scrollOrientation === 'vertical'\n ? event.touches[0].pageY - startTouch.current[0].pageY\n : normalizedHorizontalValue(\n event.touches[0].pageX - startTouch.current[0].pageX,\n )\n } else {\n return scrollOrientation === 'vertical'\n ? event.touches[0].pageY - startBouncingTouch.current[0].pageY\n : normalizedHorizontalValue(\n event.touches[0].pageX - startBouncingTouch.current[0].pageX,\n )\n }\n }\n return 0\n }\n\n // Key bouncing status judgement.\n function getBouncingStatus() {\n 'main thread'\n // @ts-expect-error Expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const currentPosition = bouncingPositionInfo.current?.bouncingOffset ?? 0\n if (Boolean(toUpper.current) && Boolean(toLower.current)) {\n return alwaysBouncing\n ? bouncingStatus.alwaysBouncing\n : bouncingStatus.noBouncing\n }\n\n // upper bouncing\n const initialLayoutPosition = 0\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] get bouncing status, initialLayoutPosition: ${initialLayoutPosition}, currentPosition: ${currentPosition}`,\n )\n\n if (currentPosition > initialLayoutPosition) {\n return bouncingStatus.upperBouncing\n }\n\n // bottom bouncing\n if (currentPosition < initialLayoutPosition) {\n return bouncingStatus.lowerBouncing\n }\n return bouncingStatus.inScrollingRange\n }\n\n // Whether fling and bouncing back step should be triggered.\n function shouldBounceWhenTouchEnd(status: number) {\n 'main thread'\n if (\n status === bouncingStatus.inScrollingRange\n || status === bouncingStatus.noBouncing\n ) {\n return false\n }\n\n if (\n status === bouncingStatus.upperBouncing\n || status === bouncingStatus.lowerBouncing\n ) {\n return true\n }\n\n if (status === bouncingStatus.alwaysBouncing) {\n return alwaysBouncing\n }\n return false\n }\n\n // Use translate to implement real bouncing effect\n function bouncingSetStyle(offset: number) {\n 'main thread'\n if (isNaN(Number(offset))) {\n mtsLog(\n true,\n '[lynx-ui-scroll-view][useBounce] ERROR! bouncingOffset is NaN',\n )\n return\n }\n // update bouncingPositionInfo first\n if (isEmpty(bouncingPositionInfo.current)) {\n // @ts-expect-error expected\n bouncingPositionInfo.current.velocity = 0\n } else {\n // @ts-expect-error expected\n const timeDiff = Date.now() - bouncingPositionInfo.current.timeStamp\n // @ts-expect-error expected\n const offsetDiff = offset - bouncingPositionInfo.current.bouncingOffset\n || 0\n if (timeDiff > 0) {\n // @ts-expect-error expected\n bouncingPositionInfo.current.velocity = offsetDiff / timeDiff\n }\n // If timeDiff <= 0, we keep the previous velocity to maintain momentum continuity.\n }\n // @ts-expect-error expected\n bouncingPositionInfo.current.bouncingOffset = offset\n // @ts-expect-error expected\n bouncingPositionInfo.current.timeStamp = Date.now()\n // When bouncing effect ends, clear startTouch and bouncingTouchStartPosition\n if (offset === 0 && prevTouch.current !== null) {\n startTouch.current = prevTouch.current\n bouncingTouchStartPosition.current = {}\n }\n // trigger translate\n if (isVertical()) {\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] apply transform, orientation: vertical, rawOffset: ${offset}, containerTransform: translateY(${offset}px)`,\n )\n selectorMT(containerID)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n } else {\n const visualOffset = enableRTL.current ? -offset : offset\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] apply transform, orientation: horizontal, rawOffset: ${offset}, enableRTL: ${\n String(enableRTL.current)\n }, visualOffset: ${visualOffset}, containerTransform: translateX(${visualOffset}px)`,\n )\n selectorMT(containerID)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n }\n }\n\n function onScrollToBouncesJS(info: scrollToBouncesInfo) {\n if (enableBounces && onScrollToBounces) {\n onScrollToBounces(info)\n }\n }\n\n // send the scrollToBounces event\n function triggerScrollToBouncesEvent(isUpper: boolean) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] trigger scrollToBounces, direction: ${\n isUpper ? 'upper' : 'lower'\n }`,\n )\n\n const info: scrollToBouncesInfo = {\n direction: isUpper ? 'upper' : 'lower',\n }\n runOnBackground(onScrollToBouncesJS)(info)\n }\n\n function rubberEffect(isNegative: 1 | -1, delta: number) {\n 'main thread'\n const scrollViewFrameSize = isVertical() ? height.current : width.current\n // If the touchStartPosition is not zero, it means this rubber effect happens during a touch or another bouncing effect. So the real 'start delta' should be recalculated.\n const touchStartPosition = Math.abs(\n Number(\n isEmpty(startTouchBouncingDelta.current)\n ? bouncingTouchStartPosition.current\n : startTouchBouncingDelta.current,\n ),\n )\n // This deltaYForTouchStartPosition is the inverse function of rubberEffect function\n const deltaYForTouchStartPosition =\n (scrollViewFrameSize * touchStartPosition)\n / ((scrollViewFrameSize - touchStartPosition) * rubberC.current) || 0\n // Here it calculate the next touchDelta. deltaYForNextPosition = (touch point where bouncing happens + corresponding touch delta where previous bouncing position locates)\n // This isNegative is used to handle the upper/lower bounce. RubberEffect function is different in the range (-inf,0) and [0, inf). We only use the [0, inf) part.\n const deltaYForNextPosition = bouncingTouchStartPosition.current\n ? deltaYForTouchStartPosition + isNegative * delta\n : isNegative * delta\n // Real calculation. Note that we don't use the raw touchDelta for calculating, instead, we use deltaYForNextPosition.\n const rubberBandingDistance = Math.max(\n 0,\n (1.0\n - 1.0\n / ((deltaYForNextPosition * rubberC.current) / scrollViewFrameSize\n + 1.0))\n * scrollViewFrameSize,\n )\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] rubber effect, scrollViewFrameSize: ${scrollViewFrameSize}, touchStartPosition: ${touchStartPosition}, deltaYForTouchStartPosition: ${deltaYForTouchStartPosition}, deltaYForNextPosition: ${deltaYForNextPosition}, rubberBandingDistance: ${rubberBandingDistance}`,\n )\n\n bouncingSetStyle(isNegative * rubberBandingDistance)\n }\n\n function triggerRubberEffectIfCrossingEdge(event: MainThread.TouchEvent) {\n 'main thread'\n const delta = getCurrentDelta(event)\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] check crossing edge, delta: ${delta}, toUpper: ${\n String(toUpper.current)\n }, toLower: ${String(toLower.current)}`,\n )\n\n // Crossing top range\n if (\n toUpper.current === true && delta > 0\n && (singleSidedBounce.current === 'both'\n || singleSidedBounce.current === 'upper')\n ) {\n enableScroll(false)\n rubberEffect(delta > 0 ? 1 : -1, delta)\n }\n\n // Crossing bottom range\n if (\n toLower.current === true && delta < 0\n && (singleSidedBounce.current === 'both'\n || singleSidedBounce.current === 'lower')\n ) {\n enableScroll(false)\n rubberEffect(delta > 0 ? 1 : -1, delta)\n }\n enableScroll(true)\n }\n\n // return true if scrollToBounces should be sent\n function isOverTriggerDistance() {\n 'main thread'\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const bouncingTop: number = bouncingPositionInfo.current.bouncingOffset ?? 0\n const triggerDistance =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0\n ? startBounceTriggerDistance\n : endBounceTriggerDistance\n const delta = Math.abs(bouncingTop) - Math.abs(triggerDistance)\n return delta > threshold()\n }\n\n function bouncingBack() {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling forward end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bounce back starts',\n )\n\n // step3: bounce back\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const C1 = bouncingPositionInfo.current.bouncingOffset ?? 0\n const startTime = Date.now()\n const touchingEndBouncingBackFrame = () => {\n if (Boolean(touchingEndBouncingBackEnableFlag.current) === false) {\n return\n }\n const currentTime = Date.now() - startTime\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touching end bouncing back frame',\n )\n\n // critical damping\n const C2 = beta.current * C1\n const easedDistance = (C1 + C2 * (currentTime / 1000))\n * Math.pow(Math.E, -beta.current * (currentTime / 1000))\n bouncingSetStyle(easedDistance)\n if (Math.abs(easedDistance) < threshold()) {\n // Make sure it backs to 0\n bouncingSetStyle(0)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bounce back ends',\n )\n } else {\n customRequestAnimationFrame(touchingEndBouncingBackFrame)\n }\n }\n\n customRequestAnimationFrame(touchingEndBouncingBackFrame)\n touchingEndBouncingBackEnableFlag.current = true\n }\n\n // bindtouchstart. Save startTouch and bouncingPosition if a bouncing effect is happening.\n function bounceableTouchStart(event: MainThread.TouchEvent) {\n 'main thread'\n startTouch.current = event.touches\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] touch start')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n bouncingTouchStartPosition.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n // reset all animation flags. No animation should play during a touch.\n touchEndFrameEnableFlag.current = false\n touchingEndBouncingBackEnableFlag.current = false\n flingEndWithBouncingEnableFlag.current = false\n }\n\n function bounceableTouchMove(event: MainThread.TouchEvent) {\n 'main thread'\n prevTouch.current = event.touches\n if (startTouch.current === null) {\n // It means current situation is illegal. A touchMove event happens without a touchStart event beforehand. Or a touchMove event happens after a touchEnd event.\n mtsLog(true, '[lynx-ui-scroll-view][useBounce] ERROR! touch not started')\n } else {\n const delta = getCurrentDelta(event)\n const currentBouncingStatus = getBouncingStatus()\n // Judge the status and trigger rubberEffect. The TouchMove should only consider rubberEffect and nothing else.\n switch (currentBouncingStatus) {\n case bouncingStatus.upperBouncing: {\n enableScroll(false)\n rubberEffect(1, delta)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move upper bouncing',\n )\n break\n }\n case bouncingStatus.lowerBouncing: {\n enableScroll(false)\n rubberEffect(-1, delta)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move lower bouncing',\n )\n break\n }\n case bouncingStatus.alwaysBouncing: {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move always bouncing',\n )\n if (alwaysBouncing) {\n triggerRubberEffectIfCrossingEdge(event)\n }\n break\n }\n case bouncingStatus.inScrollingRange: {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move in scrolling range',\n )\n triggerRubberEffectIfCrossingEdge(event)\n break\n }\n default:\n break\n }\n }\n }\n\n // bindtouchend. In touchEnd event the fling forward animation and bouncingBack animation should be triggered if necessary.\n function bounceableTouchEnd() {\n 'main thread'\n // Reset the state. The touch information should be reset, and we should no longer ban the enable-scroll.\n clearTouchInfo()\n enableScroll(true)\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] touch end')\n if (shouldBounceWhenTouchEnd(getBouncingStatus())) {\n const startTime = Date.now()\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const dragEndVelocity = bouncingPositionInfo.current?.velocity\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const dragEndPosition = bouncingPositionInfo.current?.bouncingOffset ?? 0\n // Send scrolltobounces event.\n if (isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let currentVelocity: number = dragEndVelocity\n const touchEndProcessFrame = () => {\n if (Boolean(touchEndFrameEnableFlag.current) === false) {\n return\n }\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch end process frame',\n )\n if (Math.abs(currentVelocity) <= threshold()) {\n // If the velocity is already under threshold, skip fling and start step3: bounce back.\n bouncingBack()\n } else {\n // If the drag end with a velocity, start fling to consume it.\n // step 2: fling down\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling down start',\n )\n // This function is obtained by integrating the velocity function with a deceleration rate of flingDeceleratingRate.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const distance: number = dragEndPosition\n + (dragEndVelocity\n * (Math.pow(\n flingDeceleratingRate.current,\n Date.now() - startTime,\n )\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(distance)\n currentVelocity = dragEndVelocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (touchEndFrameEnableFlag.current) {\n customRequestAnimationFrame(touchEndProcessFrame)\n }\n }\n }\n customRequestAnimationFrame(touchEndProcessFrame)\n touchEndFrameEnableFlag.current = true\n }\n }\n\n // Save the bindscroll info and calculate velocity.\n function bounceableHandleScroll(event: ScrollEvent) {\n 'main thread'\n scrollX.current = event.detail.scrollLeft\n scrollY.current = event.detail.scrollTop\n if (!isEmpty(prevScroll.current)) {\n const prev = prevScroll.current as {\n timestamp: number\n detail: { scrollTop: number, scrollLeft: number }\n }\n const timeDuration = Date.now() - prev.timestamp\n if (timeDuration > 0) {\n const deltaY = isVertical()\n ? event.detail.scrollTop - prev.detail.scrollTop\n : normalizedHorizontalValue(\n event.detail.scrollLeft - prev.detail.scrollLeft,\n )\n const velocity = deltaY / timeDuration\n if (Number.isFinite(velocity)) {\n scrollVelocity.current = velocity\n }\n }\n }\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] handle scroll near edge, scrollLeft: ${event.detail.scrollLeft}, scrollTop: ${event.detail.scrollTop}, velocity: ${scrollVelocity.current}`,\n )\n prevScroll.current = event\n }\n\n function onUpperDisexposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] upper disexposure',\n )\n toUpper.current = false\n }\n\n // Handle scrolltoupper event.\n function onUpperExposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] upper exposure')\n toUpper.current = true\n if (\n singleSidedBounce.current !== 'upper'\n && singleSidedBounce.current !== 'both'\n ) {\n return\n }\n if (prevScroll.current) {\n // reaches edge during touch\n startBouncingTouch.current = prevTouch.current\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n startTouchBouncingDelta.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n } else if (Math.abs(scrollVelocity.current) > threshold()) {\n // reaches edge during fling\n const velocity = scrollVelocity.current\n let currentVelocity = velocity\n const startTime = Date.now()\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] fling to upper event start, velocity: ${velocity}`,\n )\n let sentScrollToBouncesEvent = false // only sent scrollToBounces once\n const flingEndWithBouncingFrame = () => {\n if (Boolean(flingEndWithBouncingEnableFlag.current) === false) {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] flingEndWithBouncingEnableFlag early return',\n )\n return\n }\n if (Math.abs(currentVelocity) <= threshold()) {\n flingEndWithBouncingEnableFlag.current = false\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling to upper event end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bouncing to upper event start',\n )\n bouncingBack()\n } else {\n // step 1: fling\n const distance = (currentVelocity\n * (Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(-distance)\n if (!sentScrollToBouncesEvent && isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n sentScrollToBouncesEvent = true\n }\n currentVelocity = velocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (flingEndWithBouncingEnableFlag.current) {\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n }\n }\n }\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n flingEndWithBouncingEnableFlag.current = true\n }\n }\n\n function onLowerDisexposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] lower disexposure',\n )\n toLower.current = false\n }\n\n function onLowerExposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] lower exposure')\n toLower.current = true\n if (\n singleSidedBounce.current !== 'lower'\n && singleSidedBounce.current !== 'both'\n ) {\n return\n }\n // reaches lower during dragging\n if (prevTouch.current !== null) {\n startBouncingTouch.current = prevTouch.current\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n startTouchBouncingDelta.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n } else if (enableBounceEventInFling && scrollVelocity.current > 0) {\n const velocity = scrollVelocity.current\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] lower velocity: ${velocity}`,\n )\n\n // scroll to end with velocity, start bouncing effect\n if (Math.abs(velocity) > threshold()) {\n let currentVelocity = velocity\n const startTime = Date.now()\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] fling to lower event start, velocity: ${velocity}`,\n )\n let sentScrollToBouncesEvent = false // only sent scrollToBounces once\n const flingEndWithBouncingFrame = () => {\n if (Boolean(flingEndWithBouncingEnableFlag.current) === false) {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] flingEndWithBouncingEnableFlag early return',\n )\n return\n }\n if (Math.abs(currentVelocity) <= threshold()) {\n flingEndWithBouncingEnableFlag.current = false\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling to lower event end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bouncing to lower event start',\n )\n bouncingBack()\n } else {\n // step 1: fling\n const distance = (currentVelocity\n * (Math.pow(\n flingDeceleratingRate.current,\n Date.now() - startTime,\n )\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(-distance)\n if (!sentScrollToBouncesEvent && isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n sentScrollToBouncesEvent = true\n }\n currentVelocity = velocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (flingEndWithBouncingEnableFlag) {\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n }\n }\n }\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n flingEndWithBouncingEnableFlag.current = true\n }\n }\n }\n\n // Used to get the size of scroll container.\n function bounceableLayoutChange(event: CommonEvent) {\n 'main thread'\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n height.current = (isAndroid() ? event.params?.height : event.detail?.height)\n ?? 0\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n width.current = (isAndroid() ? event.params?.width : event.detail?.width)\n ?? 0\n }\n\n return {\n 'main-thread:bindtouchstart': bounceableTouchStart,\n 'main-thread:bindtouchend': bounceableTouchEnd,\n 'main-thread:bindtouchmove': bounceableTouchMove,\n 'main-thread:bindlayoutchange': bounceableLayoutChange,\n 'main-thread:bindscroll': bounceableHandleScroll,\n onUpperExposure,\n onUpperDisexposure,\n onLowerExposure,\n onLowerDisexposure,\n }\n}\n"],"names":["useBounce","options","rubberC","useMainThreadRef","flingDeceleratingRate","beta","debugLogEnabled","Boolean","singleSidedBounce","startTouch","prevTouch","scrollVelocity","bouncingPositionInfo","startBouncingTouch","startTouchBouncingDelta","bouncingTouchStartPosition","prevScroll","height","SystemInfo","width","scrollX","scrollY","touchEndFrameEnableFlag","touchingEndBouncingBackEnableFlag","flingEndWithBouncingEnableFlag","toUpper","toLower","containerID","enableBounces","onScrollToBounces","alwaysBouncing","scrollOrientation","enableRTL","enableBounceEventInFling","startBounceTriggerDistance","endBounceTriggerDistance","temporaryValidVersionCheckForRAF","log","bouncingStatus","isVertical","threshold","Number","normalizedHorizontalValue","value","isAndroid","isEmpty","obj","Object","enableScroll","enable","selectorMT","clearTouchInfo","mtsLog","customRequestAnimationFrame","animationFunc","requestAnimationFrame","setTimeout","getCurrentDelta","event","getBouncingStatus","currentPosition","initialLayoutPosition","shouldBounceWhenTouchEnd","status","bouncingSetStyle","offset","isNaN","timeDiff","Date","offsetDiff","visualOffset","String","onScrollToBouncesJS","info","triggerScrollToBouncesEvent","isUpper","runOnBackground","rubberEffect","isNegative","delta","scrollViewFrameSize","touchStartPosition","Math","deltaYForTouchStartPosition","deltaYForNextPosition","rubberBandingDistance","triggerRubberEffectIfCrossingEdge","isOverTriggerDistance","bouncingTop","triggerDistance","bouncingBack","C1","startTime","touchingEndBouncingBackFrame","currentTime","C2","easedDistance","bounceableTouchStart","bounceableTouchMove","currentBouncingStatus","bounceableTouchEnd","dragEndVelocity","dragEndPosition","currentVelocity","touchEndProcessFrame","distance","bounceableHandleScroll","prev","timeDuration","deltaY","velocity","onUpperDisexposure","_event","onUpperExposure","sentScrollToBouncesEvent","flingEndWithBouncingFrame","onLowerDisexposure","onLowerExposure","bounceableLayoutChange"],"mappings":";;AAwDO,SAASA,UAAUC,OAAyB;IAEjD,MAAMC,UAAUC,iBAAiB;IAEjC,MAAMC,wBAAwBD,iBAAiB;IAE/C,MAAME,OAAOF,iBAAiB;IAE9B,MAAMG,kBAAkBC,QAAQN,QAAQ,QAAQ;IAEhD,MAAMO,oBAAoBL,iBACxBF,QAAQ,iBAAiB,CAAC,iBAAiB,IAAI;IAIjD,MAAMQ,aAAaN,iBACjB;IAGF,MAAMO,YAAYP,iBAChB;IAIF,MAAMQ,iBAAiBR,iBAAiB;IAExC,MAAMS,uBAAuBT,iBAAiB,CAAC;IAG/C,MAAMU,qBAAqBV,iBAEzB;IAEF,MAAMW,0BAA0BX,iBAAiB,CAAC;IAElD,MAAMY,6BAA6BZ,iBAAiB,CAAC;IAGrD,MAAMa,aAAab,iBAAiB,CAAC;IAGrC,MAAMc,SAASd,iBACbF,QAAQ,iBAAiB,CAAC,eAAe,IACpCiB,WAAW,WAAW,GAAGA,WAAW,UAAU;IAErD,MAAMC,QAAQhB,iBACZF,QAAQ,iBAAiB,CAAC,cAAc,IACnCiB,WAAW,UAAU,GAAGA,WAAW,UAAU;IAEpD,MAAME,UAAUjB,iBAAiB;IACjC,MAAMkB,UAAUlB,iBAAiB;IAGjC,MAAMmB,0BAA0BnB,iBAAiB;IACjD,MAAM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;YAC3C;QACF;IACF;IAGA,SAAS8F,uBAAuB5D,KAAkB;QAChD;QAGAzC,OAAO,OAAO,GAAI2B,AAAAA,CAAAA,cAAcc,MAAM,MAAM,EAAE,SAASA,MAAM,MAAM,EAAE,MAAK,KACrE;QAGLvC,MAAM,OAAO,GAAIyB,AAAAA,CAAAA,cAAcc,MAAM,MAAM,EAAE,QAAQA,MAAM,MAAM,EAAE,KAAI,KAClE;IACP;IAEA,OAAO;QACL,8BAA8BuC;QAC9B,4BAA4BG;QAC5B,6BAA6BF;QAC7B,gCAAgCoB;QAChC,0BAA0BZ;QAC1BO;QACAF;QACAM;QACAD;IACF;AACF"}
1
+ {"version":3,"file":"hooks/useBounce.jsx","sources":["../../src/hooks/useBounce.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { runOnBackground, useMainThreadRef } from '@lynx-js/react'\n\nimport { log, mtsLog, selectorMT } from '@lynx-js/lynx-ui-common'\nimport type { CommonEvent, MainThread, ScrollEvent } from '@lynx-js/types'\n\nexport interface scrollToBouncesInfo {\n direction: 'upper' | 'lower'\n}\n\nexport interface BounceableBasicProps {\n enableBounces: boolean\n enableBounceEventInFling?: boolean\n startBounceTriggerDistance?: number\n endBounceTriggerDistance?: number\n // biome-ignore lint/suspicious/noExplicitAny: expected\n upperBounceItem?: any\n // biome-ignore lint/suspicious/noExplicitAny: expected\n lowerBounceItem?: any\n alwaysBouncing?: boolean\n singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'\n estimatedHeight?: number\n estimatedWidth?: number\n validAnimationVersion?: boolean\n onScrollToBounces?: (e: scrollToBouncesInfo) => void\n}\n\nexport interface useBounceOptions {\n bounceableOptions: BounceableBasicProps\n debugLog?: boolean\n enableRTL?: boolean\n /**\n * idSelector of scroll container\n */\n id?: string\n /**\n * scroll direction\n */\n scrollOrientation: 'vertical' | 'horizontal'\n}\n\nexport interface bounceHandlers {\n 'main-thread:bindtouchstart': (event: MainThread.TouchEvent) => void\n 'main-thread:bindtouchend': () => void\n 'main-thread:bindtouchmove': (event: MainThread.TouchEvent) => void\n 'main-thread:bindlayoutchange': (event: CommonEvent) => void\n 'main-thread:bindscroll': (event: ScrollEvent) => void\n onUpperExposure: (_event: CommonEvent) => void\n onUpperDisexposure: (_event: CommonEvent) => void\n onLowerExposure: (_event: CommonEvent) => void\n onLowerDisexposure: (_event: CommonEvent) => void\n}\n\nexport function useBounce(options: useBounceOptions): bounceHandlers {\n // Control the damping coefficient during rubber effect. The smaller it is, the harder the spring effect.\n const rubberC = useMainThreadRef(0.55)\n // Control the fling deceleration coefficient during dropdown. The smaller it is, the faster it stops.\n const flingDeceleratingRate = useMainThreadRef(0.99)\n // The rebound coefficient during bounce back, the larger it is, the faster the rebound speed.\n const beta = useMainThreadRef(15)\n\n const debugLogEnabled = Boolean(options.debugLog)\n\n const singleSidedBounce = useMainThreadRef(\n options.bounceableOptions.singleSidedBounce ?? 'both',\n )\n\n // The starting point of current touch procedure\n const startTouch = useMainThreadRef<MainThread.TouchEvent['touches'] | null>(\n null,\n )\n // Record the previous touch and clear it on touchEnd. If current is not empty, then it means that the scrollable object is being dragged.\n const prevTouch = useMainThreadRef<MainThread.TouchEvent['touches'] | null>(\n null,\n )\n\n // Current scroll velocity.\n const scrollVelocity = useMainThreadRef(0)\n // Current bouncing position.\n const bouncingPositionInfo = useMainThreadRef({})\n\n // If reaches edge and bouncing starts during dragging, save the touch point and calculate later touch delta for rubberEffect.\n const startBouncingTouch = useMainThreadRef<\n MainThread.TouchEvent['touches'] | null\n >(null)\n // If reaches edge and bouncing starts during dragging, save current bouncingPosition and continues rubberEffect's calculation from this point.\n const startTouchBouncingDelta = useMainThreadRef({})\n // when touch starts during bouncing, save current bouncingPosition and continues rubberEffect's calculation from this point.\n const bouncingTouchStartPosition = useMainThreadRef({})\n\n // Used to record the previous scroll position and calculate current scroll velocity.\n const prevScroll = useMainThreadRef({})\n\n // scroll container's basic info.\n const height = useMainThreadRef(\n options.bounceableOptions.estimatedHeight\n ?? SystemInfo.pixelHeight / SystemInfo.pixelRatio,\n )\n const width = useMainThreadRef(\n options.bounceableOptions.estimatedWidth\n ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio,\n )\n const scrollX = useMainThreadRef(0)\n const scrollY = useMainThreadRef(0)\n\n // Flags for ending bouncing animation.\n const touchEndFrameEnableFlag = useMainThreadRef(false)\n const touchingEndBouncingBackEnableFlag = useMainThreadRef(false)\n const flingEndWithBouncingEnableFlag = useMainThreadRef(false)\n\n // Flags for reaches upper/lower edge.\n // When content's size is smaller than viewport, these two flags are both true.\n const toUpper = useMainThreadRef(false)\n const toLower = useMainThreadRef(false)\n\n // Read from props\n const containerID = options.id ?? 'bounceableContainer'\n const { enableBounces, onScrollToBounces } = options.bounceableOptions\n const alwaysBouncing = options.bounceableOptions.alwaysBouncing ?? false\n const scrollOrientation = options.scrollOrientation ?? 'vertical'\n const enableRTL = useMainThreadRef(options.enableRTL ?? false)\n const enableBounceEventInFling =\n options.bounceableOptions.enableBounceEventInFling ?? true\n const startBounceTriggerDistance =\n options.bounceableOptions.startBounceTriggerDistance ?? 0\n const endBounceTriggerDistance =\n options.bounceableOptions.endBounceTriggerDistance ?? 0\n // Temporary workaround as requestAnimationFrame will crash below Lynx 2.15.2.\n const temporaryValidVersionCheckForRAF = useMainThreadRef(\n options.bounceableOptions.validAnimationVersion ?? false,\n )\n log(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] init, enableBounces: ${enableBounces}, orientation: ${scrollOrientation}, enableRTL: ${\n options.enableRTL ?? false\n }`,\n )\n\n const bouncingStatus = {\n inScrollingRange: 0,\n upperBouncing: 1,\n lowerBouncing: 2,\n noBouncing: 3,\n alwaysBouncing: 4,\n }\n\n function isVertical() {\n 'main thread'\n return scrollOrientation === 'vertical'\n }\n\n function threshold() {\n 'main thread'\n return 1.0 / Number(SystemInfo.pixelRatio)\n }\n\n function normalizedHorizontalValue(value: number) {\n 'main thread'\n return enableRTL.current ? -value : value\n }\n\n function isAndroid() {\n 'main thread'\n return SystemInfo.platform === 'Android'\n }\n\n function isEmpty(obj: Record<string, unknown>) {\n 'main thread'\n return !obj || Object.keys(obj).length === 0\n }\n\n function enableScroll(enable: boolean) {\n 'main thread'\n // Android will trigger scroll during bouncing, cancel it while bouncing.\n if (isAndroid()) {\n selectorMT(containerID)?.setAttribute('enable-scroll', enable)\n }\n }\n\n // Clear all temps when a touch procedure ends.\n function clearTouchInfo() {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] clear touch info')\n startTouch.current = null\n bouncingTouchStartPosition.current = 0\n prevTouch.current = null\n startBouncingTouch.current = null\n startTouchBouncingDelta.current = 0\n }\n\n // Temporary workaround as requestAnimationFrame will crash below Lynx 2.15.2.\n function customRequestAnimationFrame(animationFunc: () => void) {\n 'main thread'\n if (temporaryValidVersionCheckForRAF.current) {\n requestAnimationFrame(animationFunc)\n } else {\n setTimeout(animationFunc, 8)\n }\n }\n\n // Calculate current touch delta based on 'startPoint'. The startPoint here should be startBouncingTouch which means this bouncing effect happens during a touch procedure.\n function getCurrentDelta(event: MainThread.TouchEvent) {\n 'main thread'\n if (startTouch.current !== null) {\n if (startBouncingTouch.current === null) {\n return scrollOrientation === 'vertical'\n ? event.touches[0].pageY - startTouch.current[0].pageY\n : normalizedHorizontalValue(\n event.touches[0].pageX - startTouch.current[0].pageX,\n )\n } else {\n return scrollOrientation === 'vertical'\n ? event.touches[0].pageY - startBouncingTouch.current[0].pageY\n : normalizedHorizontalValue(\n event.touches[0].pageX - startBouncingTouch.current[0].pageX,\n )\n }\n }\n return 0\n }\n\n // Key bouncing status judgement.\n function getBouncingStatus() {\n 'main thread'\n // @ts-expect-error Expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const currentPosition = bouncingPositionInfo.current?.bouncingOffset ?? 0\n if (Boolean(toUpper.current) && Boolean(toLower.current)) {\n return alwaysBouncing\n ? bouncingStatus.alwaysBouncing\n : bouncingStatus.noBouncing\n }\n\n // upper bouncing\n const initialLayoutPosition = 0\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] get bouncing status, initialLayoutPosition: ${initialLayoutPosition}, currentPosition: ${currentPosition}`,\n )\n\n if (currentPosition > initialLayoutPosition) {\n return bouncingStatus.upperBouncing\n }\n\n // bottom bouncing\n if (currentPosition < initialLayoutPosition) {\n return bouncingStatus.lowerBouncing\n }\n return bouncingStatus.inScrollingRange\n }\n\n // Whether fling and bouncing back step should be triggered.\n function shouldBounceWhenTouchEnd(status: number) {\n 'main thread'\n if (\n status === bouncingStatus.inScrollingRange\n || status === bouncingStatus.noBouncing\n ) {\n return false\n }\n\n if (\n status === bouncingStatus.upperBouncing\n || status === bouncingStatus.lowerBouncing\n ) {\n return true\n }\n\n if (status === bouncingStatus.alwaysBouncing) {\n return alwaysBouncing\n }\n return false\n }\n\n // Use translate to implement real bouncing effect\n function bouncingSetStyle(offset: number) {\n 'main thread'\n if (isNaN(Number(offset))) {\n mtsLog(\n true,\n '[lynx-ui-scroll-view][useBounce] ERROR! bouncingOffset is NaN',\n )\n return\n }\n // update bouncingPositionInfo first\n if (isEmpty(bouncingPositionInfo.current)) {\n // @ts-expect-error expected\n bouncingPositionInfo.current.velocity = 0\n } else {\n // @ts-expect-error expected\n const timeDiff = Date.now() - bouncingPositionInfo.current.timeStamp\n // @ts-expect-error expected\n const offsetDiff = offset - bouncingPositionInfo.current.bouncingOffset\n || 0\n if (timeDiff > 0) {\n // @ts-expect-error expected\n bouncingPositionInfo.current.velocity = offsetDiff / timeDiff\n }\n // If timeDiff <= 0, we keep the previous velocity to maintain momentum continuity.\n }\n // @ts-expect-error expected\n bouncingPositionInfo.current.bouncingOffset = offset\n // @ts-expect-error expected\n bouncingPositionInfo.current.timeStamp = Date.now()\n // When bouncing effect ends, clear startTouch and bouncingTouchStartPosition\n if (offset === 0 && prevTouch.current !== null) {\n startTouch.current = prevTouch.current\n bouncingTouchStartPosition.current = {}\n }\n // trigger translate\n if (isVertical()) {\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] apply transform, orientation: vertical, rawOffset: ${offset}, containerTransform: translateY(${offset}px)`,\n )\n selectorMT(containerID)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${offset}px)`,\n )\n } else {\n const visualOffset = enableRTL.current ? -offset : offset\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] apply transform, orientation: horizontal, rawOffset: ${offset}, enableRTL: ${\n String(enableRTL.current)\n }, visualOffset: ${visualOffset}, containerTransform: translateX(${visualOffset}px)`,\n )\n selectorMT(containerID)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${visualOffset}px)`,\n )\n }\n }\n\n function onScrollToBouncesJS(info: scrollToBouncesInfo) {\n if (enableBounces && onScrollToBounces) {\n onScrollToBounces(info)\n }\n }\n\n // send the scrollToBounces event\n function triggerScrollToBouncesEvent(isUpper: boolean) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] trigger scrollToBounces, direction: ${\n isUpper ? 'upper' : 'lower'\n }`,\n )\n\n const info: scrollToBouncesInfo = {\n direction: isUpper ? 'upper' : 'lower',\n }\n runOnBackground(onScrollToBouncesJS)(info)\n }\n\n function rubberEffect(isNegative: 1 | -1, delta: number) {\n 'main thread'\n const scrollViewFrameSize = isVertical() ? height.current : width.current\n // If the touchStartPosition is not zero, it means this rubber effect happens during a touch or another bouncing effect. So the real 'start delta' should be recalculated.\n const touchStartPosition = Math.abs(\n Number(\n isEmpty(startTouchBouncingDelta.current)\n ? bouncingTouchStartPosition.current\n : startTouchBouncingDelta.current,\n ),\n )\n // This deltaYForTouchStartPosition is the inverse function of rubberEffect function\n const deltaYForTouchStartPosition =\n (scrollViewFrameSize * touchStartPosition)\n / ((scrollViewFrameSize - touchStartPosition) * rubberC.current) || 0\n // Here it calculate the next touchDelta. deltaYForNextPosition = (touch point where bouncing happens + corresponding touch delta where previous bouncing position locates)\n // This isNegative is used to handle the upper/lower bounce. RubberEffect function is different in the range (-inf,0) and [0, inf). We only use the [0, inf) part.\n const deltaYForNextPosition = bouncingTouchStartPosition.current\n ? deltaYForTouchStartPosition + isNegative * delta\n : isNegative * delta\n // Real calculation. Note that we don't use the raw touchDelta for calculating, instead, we use deltaYForNextPosition.\n const rubberBandingDistance = Math.max(\n 0,\n (1.0\n - 1.0\n / ((deltaYForNextPosition * rubberC.current) / scrollViewFrameSize\n + 1.0))\n * scrollViewFrameSize,\n )\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] rubber effect, scrollViewFrameSize: ${scrollViewFrameSize}, touchStartPosition: ${touchStartPosition}, deltaYForTouchStartPosition: ${deltaYForTouchStartPosition}, deltaYForNextPosition: ${deltaYForNextPosition}, rubberBandingDistance: ${rubberBandingDistance}`,\n )\n\n bouncingSetStyle(isNegative * rubberBandingDistance)\n }\n\n function triggerRubberEffectIfCrossingEdge(event: MainThread.TouchEvent) {\n 'main thread'\n const delta = getCurrentDelta(event)\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] check crossing edge, delta: ${delta}, toUpper: ${\n String(toUpper.current)\n }, toLower: ${String(toLower.current)}`,\n )\n\n // Crossing top range\n if (\n toUpper.current === true && delta > 0\n && (singleSidedBounce.current === 'both'\n || singleSidedBounce.current === 'upper')\n ) {\n enableScroll(false)\n rubberEffect(delta > 0 ? 1 : -1, delta)\n }\n\n // Crossing bottom range\n if (\n toLower.current === true && delta < 0\n && (singleSidedBounce.current === 'both'\n || singleSidedBounce.current === 'lower')\n ) {\n enableScroll(false)\n rubberEffect(delta > 0 ? 1 : -1, delta)\n }\n enableScroll(true)\n }\n\n // return true if scrollToBounces should be sent\n function isOverTriggerDistance() {\n 'main thread'\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const bouncingTop: number = bouncingPositionInfo.current.bouncingOffset ?? 0\n const triggerDistance =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0\n ? startBounceTriggerDistance\n : endBounceTriggerDistance\n const delta = Math.abs(bouncingTop) - Math.abs(triggerDistance)\n return delta > threshold()\n }\n\n function bouncingBack() {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling forward end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bounce back starts',\n )\n\n // step3: bounce back\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const C1 = bouncingPositionInfo.current.bouncingOffset ?? 0\n const startTime = Date.now()\n const touchingEndBouncingBackFrame = () => {\n if (Boolean(touchingEndBouncingBackEnableFlag.current) === false) {\n return\n }\n const currentTime = Date.now() - startTime\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touching end bouncing back frame',\n )\n\n // critical damping\n const C2 = beta.current * C1\n const easedDistance = (C1 + C2 * (currentTime / 1000))\n * Math.pow(Math.E, -beta.current * (currentTime / 1000))\n bouncingSetStyle(easedDistance)\n if (Math.abs(easedDistance) < threshold()) {\n // Make sure it backs to 0\n bouncingSetStyle(0)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bounce back ends',\n )\n } else {\n customRequestAnimationFrame(touchingEndBouncingBackFrame)\n }\n }\n\n customRequestAnimationFrame(touchingEndBouncingBackFrame)\n touchingEndBouncingBackEnableFlag.current = true\n }\n\n // bindtouchstart. Save startTouch and bouncingPosition if a bouncing effect is happening.\n function bounceableTouchStart(event: MainThread.TouchEvent) {\n 'main thread'\n startTouch.current = event.touches\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] touch start')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n bouncingTouchStartPosition.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n // reset all animation flags. No animation should play during a touch.\n touchEndFrameEnableFlag.current = false\n touchingEndBouncingBackEnableFlag.current = false\n flingEndWithBouncingEnableFlag.current = false\n }\n\n function bounceableTouchMove(event: MainThread.TouchEvent) {\n 'main thread'\n prevTouch.current = event.touches\n if (startTouch.current === null) {\n // It means current situation is illegal. A touchMove event happens without a touchStart event beforehand. Or a touchMove event happens after a touchEnd event.\n mtsLog(true, '[lynx-ui-scroll-view][useBounce] ERROR! touch not started')\n } else {\n const delta = getCurrentDelta(event)\n const currentBouncingStatus = getBouncingStatus()\n // Judge the status and trigger rubberEffect. The TouchMove should only consider rubberEffect and nothing else.\n switch (currentBouncingStatus) {\n case bouncingStatus.upperBouncing: {\n enableScroll(false)\n rubberEffect(1, delta)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move upper bouncing',\n )\n break\n }\n case bouncingStatus.lowerBouncing: {\n enableScroll(false)\n rubberEffect(-1, delta)\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move lower bouncing',\n )\n break\n }\n case bouncingStatus.alwaysBouncing: {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move always bouncing',\n )\n if (alwaysBouncing) {\n triggerRubberEffectIfCrossingEdge(event)\n }\n break\n }\n case bouncingStatus.inScrollingRange: {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch move in scrolling range',\n )\n triggerRubberEffectIfCrossingEdge(event)\n break\n }\n default:\n break\n }\n }\n }\n\n // bindtouchend. In touchEnd event the fling forward animation and bouncingBack animation should be triggered if necessary.\n function bounceableTouchEnd() {\n 'main thread'\n // Reset the state. The touch information should be reset, and we should no longer ban the enable-scroll.\n clearTouchInfo()\n enableScroll(true)\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] touch end')\n if (shouldBounceWhenTouchEnd(getBouncingStatus())) {\n const startTime = Date.now()\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const dragEndVelocity = bouncingPositionInfo.current?.velocity\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const dragEndPosition = bouncingPositionInfo.current?.bouncingOffset ?? 0\n // Send scrolltobounces event.\n if (isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let currentVelocity: number = dragEndVelocity\n const touchEndProcessFrame = () => {\n if (Boolean(touchEndFrameEnableFlag.current) === false) {\n return\n }\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] touch end process frame',\n )\n if (Math.abs(currentVelocity) <= threshold()) {\n // If the velocity is already under threshold, skip fling and start step3: bounce back.\n bouncingBack()\n } else {\n // If the drag end with a velocity, start fling to consume it.\n // step 2: fling down\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling down start',\n )\n // This function is obtained by integrating the velocity function with a deceleration rate of flingDeceleratingRate.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const distance: number = dragEndPosition\n + (dragEndVelocity\n * (Math.pow(\n flingDeceleratingRate.current,\n Date.now() - startTime,\n )\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(distance)\n currentVelocity = dragEndVelocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (touchEndFrameEnableFlag.current) {\n customRequestAnimationFrame(touchEndProcessFrame)\n }\n }\n }\n customRequestAnimationFrame(touchEndProcessFrame)\n touchEndFrameEnableFlag.current = true\n }\n }\n\n // Save the bindscroll info and calculate velocity.\n function bounceableHandleScroll(event: ScrollEvent) {\n 'main thread'\n scrollX.current = event.detail.scrollLeft\n scrollY.current = event.detail.scrollTop\n if (!isEmpty(prevScroll.current)) {\n const prev = prevScroll.current as {\n timestamp: number\n detail: { scrollTop: number, scrollLeft: number }\n }\n const timeDuration = Date.now() - prev.timestamp\n if (timeDuration > 0) {\n const deltaY = isVertical()\n ? event.detail.scrollTop - prev.detail.scrollTop\n : normalizedHorizontalValue(\n event.detail.scrollLeft - prev.detail.scrollLeft,\n )\n const velocity = deltaY / timeDuration\n if (Number.isFinite(velocity)) {\n scrollVelocity.current = velocity\n }\n }\n }\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] handle scroll near edge, scrollLeft: ${event.detail.scrollLeft}, scrollTop: ${event.detail.scrollTop}, velocity: ${scrollVelocity.current}`,\n )\n prevScroll.current = event\n }\n\n function onUpperDisexposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] upper disexposure',\n )\n toUpper.current = false\n }\n\n // Handle scrolltoupper event.\n function onUpperExposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] upper exposure')\n toUpper.current = true\n if (\n singleSidedBounce.current !== 'upper'\n && singleSidedBounce.current !== 'both'\n ) {\n return\n }\n if (prevScroll.current) {\n // reaches edge during touch\n startBouncingTouch.current = prevTouch.current\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n startTouchBouncingDelta.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n } else if (Math.abs(scrollVelocity.current) > threshold()) {\n // reaches edge during fling\n const velocity = scrollVelocity.current\n let currentVelocity = velocity\n const startTime = Date.now()\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] fling to upper event start, velocity: ${velocity}`,\n )\n let sentScrollToBouncesEvent = false // only sent scrollToBounces once\n const flingEndWithBouncingFrame = () => {\n if (Boolean(flingEndWithBouncingEnableFlag.current) === false) {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] flingEndWithBouncingEnableFlag early return',\n )\n return\n }\n if (Math.abs(currentVelocity) <= threshold()) {\n flingEndWithBouncingEnableFlag.current = false\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling to upper event end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bouncing to upper event start',\n )\n bouncingBack()\n } else {\n // step 1: fling\n const distance = (currentVelocity\n * (Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(-distance)\n if (!sentScrollToBouncesEvent && isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n sentScrollToBouncesEvent = true\n }\n currentVelocity = velocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (flingEndWithBouncingEnableFlag.current) {\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n }\n }\n }\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n flingEndWithBouncingEnableFlag.current = true\n }\n }\n\n function onLowerDisexposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] lower disexposure',\n )\n toLower.current = false\n }\n\n function onLowerExposure(_event: CommonEvent) {\n 'main thread'\n mtsLog(debugLogEnabled, '[lynx-ui-scroll-view][useBounce] lower exposure')\n toLower.current = true\n if (\n singleSidedBounce.current !== 'lower'\n && singleSidedBounce.current !== 'both'\n ) {\n return\n }\n // reaches lower during dragging\n if (prevTouch.current !== null) {\n startBouncingTouch.current = prevTouch.current\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n startTouchBouncingDelta.current =\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset ?? 0\n } else if (enableBounceEventInFling && scrollVelocity.current > 0) {\n const velocity = scrollVelocity.current\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] lower velocity: ${velocity}`,\n )\n\n // scroll to end with velocity, start bouncing effect\n if (Math.abs(velocity) > threshold()) {\n let currentVelocity = velocity\n const startTime = Date.now()\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useBounce] fling to lower event start, velocity: ${velocity}`,\n )\n let sentScrollToBouncesEvent = false // only sent scrollToBounces once\n const flingEndWithBouncingFrame = () => {\n if (Boolean(flingEndWithBouncingEnableFlag.current) === false) {\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] flingEndWithBouncingEnableFlag early return',\n )\n return\n }\n if (Math.abs(currentVelocity) <= threshold()) {\n flingEndWithBouncingEnableFlag.current = false\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] fling to lower event end',\n )\n mtsLog(\n debugLogEnabled,\n '[lynx-ui-scroll-view][useBounce] bouncing to lower event start',\n )\n bouncingBack()\n } else {\n // step 1: fling\n const distance = (currentVelocity\n * (Math.pow(\n flingDeceleratingRate.current,\n Date.now() - startTime,\n )\n - 1))\n / Math.log(flingDeceleratingRate.current)\n bouncingSetStyle(-distance)\n if (!sentScrollToBouncesEvent && isOverTriggerDistance()) {\n triggerScrollToBouncesEvent(\n // @ts-expect-error expected\n bouncingPositionInfo.current?.bouncingOffset > 0,\n )\n sentScrollToBouncesEvent = true\n }\n currentVelocity = velocity\n * Math.pow(flingDeceleratingRate.current, Date.now() - startTime)\n if (flingEndWithBouncingEnableFlag) {\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n }\n }\n }\n customRequestAnimationFrame(flingEndWithBouncingFrame)\n flingEndWithBouncingEnableFlag.current = true\n }\n }\n }\n\n // Used to get the size of scroll container.\n function bounceableLayoutChange(event: CommonEvent) {\n 'main thread'\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n height.current = (isAndroid() ? event.params?.height : event.detail?.height)\n ?? 0\n // @ts-expect-error expected\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n width.current = (isAndroid() ? event.params?.width : event.detail?.width)\n ?? 0\n }\n\n return {\n 'main-thread:bindtouchstart': bounceableTouchStart,\n 'main-thread:bindtouchend': bounceableTouchEnd,\n 'main-thread:bindtouchmove': bounceableTouchMove,\n 'main-thread:bindlayoutchange': bounceableLayoutChange,\n 'main-thread:bindscroll': bounceableHandleScroll,\n onUpperExposure,\n onUpperDisexposure,\n onLowerExposure,\n onLowerDisexposure,\n }\n}\n"],"names":["useBounce","options","rubberC","useMainThreadRef","flingDeceleratingRate","beta","debugLogEnabled","Boolean","singleSidedBounce","startTouch","prevTouch","scrollVelocity","bouncingPositionInfo","startBouncingTouch","startTouchBouncingDelta","bouncingTouchStartPosition","prevScroll","height","SystemInfo","width","scrollX","scrollY","touchEndFrameEnableFlag","touchingEndBouncingBackEnableFlag","flingEndWithBouncingEnableFlag","toUpper","toLower","containerID","enableBounces","onScrollToBounces","alwaysBouncing","scrollOrientation","enableRTL","enableBounceEventInFling","startBounceTriggerDistance","endBounceTriggerDistance","temporaryValidVersionCheckForRAF","log","bouncingStatus","isVertical","threshold","Number","normalizedHorizontalValue","value","isAndroid","isEmpty","obj","Object","enableScroll","enable","selectorMT","clearTouchInfo","mtsLog","customRequestAnimationFrame","animationFunc","requestAnimationFrame","setTimeout","getCurrentDelta","event","getBouncingStatus","currentPosition","initialLayoutPosition","shouldBounceWhenTouchEnd","status","bouncingSetStyle","offset","isNaN","timeDiff","Date","offsetDiff","visualOffset","String","onScrollToBouncesJS","info","triggerScrollToBouncesEvent","isUpper","runOnBackground","rubberEffect","isNegative","delta","scrollViewFrameSize","touchStartPosition","Math","deltaYForTouchStartPosition","deltaYForNextPosition","rubberBandingDistance","triggerRubberEffectIfCrossingEdge","isOverTriggerDistance","bouncingTop","triggerDistance","bouncingBack","C1","startTime","touchingEndBouncingBackFrame","currentTime","C2","easedDistance","bounceableTouchStart","bounceableTouchMove","currentBouncingStatus","bounceableTouchEnd","dragEndVelocity","dragEndPosition","currentVelocity","touchEndProcessFrame","distance","bounceableHandleScroll","prev","timeDuration","deltaY","velocity","onUpperDisexposure","_event","onUpperExposure","sentScrollToBouncesEvent","flingEndWithBouncingFrame","onLowerDisexposure","onLowerExposure","bounceableLayoutChange"],"mappings":";;AAwDO,SAASA,UAAUC,OAAyB;IAEjD,MAAMC,UAAUC,iBAAiB;IAEjC,MAAMC,wBAAwBD,iBAAiB;IAE/C,MAAME,OAAOF,iBAAiB;IAE9B,MAAMG,kBAAkBC,QAAQN,QAAQ,QAAQ;IAEhD,MAAMO,oBAAoBL,iBACxBF,QAAQ,iBAAiB,CAAC,iBAAiB,IAAI;IAIjD,MAAMQ,aAAaN,iBACjB;IAGF,MAAMO,YAAYP,iBAChB;IAIF,MAAMQ,iBAAiBR,iBAAiB;IAExC,MAAMS,uBAAuBT,iBAAiB,CAAC;IAG/C,MAAMU,qBAAqBV,iBAEzB;IAEF,MAAMW,0BAA0BX,iBAAiB,CAAC;IAElD,MAAMY,6BAA6BZ,iBAAiB,CAAC;IAGrD,MAAMa,aAAab,iBAAiB,CAAC;IAGrC,MAAMc,SAASd,iBACbF,QAAQ,iBAAiB,CAAC,eAAe,IACpCiB,WAAW,WAAW,GAAGA,WAAW,UAAU;IAErD,MAAMC,QAAQhB,iBACZF,QAAQ,iBAAiB,CAAC,cAAc,IACnCiB,WAAW,UAAU,GAAGA,WAAW,UAAU;IAEpD,MAAME,UAAUjB,iBAAiB;IACjC,MAAMkB,UAAUlB,iBAAiB;IAGjC,MAAMmB,0BAA0BnB,iBAAiB;IACjD,MAAMoB,oCAAoCpB,iBA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IAGA,SAAS8F,uBAAuB5D,KAAkB;QAChD;QAGAzC,OAAO,OAAO,GAAI2B,AAAAA,CAAAA,cAAcc,MAAM,MAAM,EAAE,SAASA,MAAM,MAAM,EAAE,MAAK,KACrE;QAGLvC,MAAM,OAAO,GAAIyB,AAAAA,CAAAA,cAAcc,MAAM,MAAM,EAAE,QAAQA,MAAM,MAAM,EAAE,KAAI,KAClE;IACP;IAEA,OAAO;QACL,8BAA8BuC;QAC9B,4BAA4BG;QAC5B,6BAA6BF;QAC7B,gCAAgCoB;QAChC,0BAA0BZ;QAC1BO;QACAF;QACAM;QACAD;IACF;AACF"}
package/dist/index.jsx CHANGED
@@ -4,7 +4,6 @@ import { ExposureEventsMapping, LayoutEventsMapping, ScrollEventsMapping, TouchE
4
4
  import { LazyComponent } from "@lynx-js/lynx-ui-lazy-component";
5
5
  import ScrollViewBasic from "./ScrollViewBasic.jsx";
6
6
  import ScrollViewWithBouncesHook from "./ScrollViewWithBouncesHook.jsx";
7
- import { useBounce } from "./hooks/useBounce.jsx";
8
7
  const ScrollView = memo(forwardRef(ScrollViewImpl));
9
8
  const ScrollViewEventMapping = {
10
9
  onContentSizeChange: 'bindcontentsizechanged',
@@ -100,6 +99,7 @@ function ScrollViewImpl(props, _ref) {
100
99
  {renderChildren(children, normalizedLazyOptions)}
101
100
  </ScrollViewBasic>;
102
101
  }
103
- export { ScrollView, useBounce };
102
+ export { useBounce } from "./hooks/useBounce.jsx";
103
+ export { ScrollView };
104
104
 
105
105
  //# sourceMappingURL=index.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.jsx","sources":["webpack://@lynx-js/lynx-ui-scroll-view/./src/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { forwardRef, memo, useRef } from '@lynx-js/react'\nimport type { ForwardedRef, ReactNode } from '@lynx-js/react'\n\nimport '@lynx-js/gesture-runtime'\nimport type { GestureKind } from '@lynx-js/gesture-runtime'\nimport type { LazyOptions } from '@lynx-js/lynx-ui-common'\nimport {\n ExposureEventsMapping,\n LayoutEventsMapping,\n ScrollEventsMapping,\n TouchEventsMapping,\n useRegisteredEvents,\n} from '@lynx-js/lynx-ui-common'\nimport { LazyComponent } from '@lynx-js/lynx-ui-lazy-component'\nimport type {\n CSSProperties,\n ScrollViewProps as ScrollViewElementProps,\n} from '@lynx-js/types'\n\nimport ScrollViewBasic from './ScrollViewBasic'\nimport ScrollViewWithBouncesHook from './ScrollViewWithBouncesHook'\nimport type {\n BounceableBasicProps,\n ScrollViewProps,\n ScrollViewRef,\n ScrollView as ScrollViewType,\n} from './types'\n\nexport type { ScrollViewProps, ScrollViewRef }\nexport { useBounce } from './hooks/useBounce'\nexport type { bounceHandlers } from './hooks/useBounce'\nexport type { BounceableBasicProps } from './types'\n\nexport const ScrollView = memo(forwardRef(ScrollViewImpl)) as ScrollViewType\n\nconst ScrollViewEventMapping: Record<string, string> = {\n onContentSizeChange: 'bindcontentsizechanged',\n onWheel: 'bindwheel',\n}\n\n/**\n * @example\n * ```javascript\n * <ScrollView\n scene={`viewpager_${index1}`}\n style={{ width: '100%', height: '100%' }}\n estimatedItemStyle={{ width: '100%', height: '800px' }}\n scrollOrientation='vertical'\n exposureRight=\"50px\"\n exposureBottom=\"220px\"\n >\n {scrollview.map((item, index) => (\n <view\n style={`width:100%;height:580rpx;`}\n >\n <text>{`slot-${index}`}</text>\n </view>\n ))}\n </ScrollView>\n * ```\n */\nfunction ScrollViewImpl(\n props: ScrollViewProps,\n _ref: ForwardedRef<ScrollViewRef>,\n) {\n const {\n scrollviewId = 'scrollview',\n horizontal = false,\n style,\n children,\n scrollOrientation,\n lazyOptions,\n className = '',\n debugLog = false,\n enableRTL = false,\n bounceableOptions = {\n enableBounces: true,\n singleSidedBounce: 'iOSBounces',\n },\n enableScroll = true,\n enableScrollMonitor = false,\n scrollMonitorTag,\n sticky,\n scrollPropagationBehavior = 'native',\n temporaryBlockScrollClass = 'BDXLynxViewPager',\n temporaryBlockScrollTag = 0,\n temporaryNestedScroll,\n experimentalNestedScrollForward,\n experimentalNestedScrollBackward,\n androidTouchSlop,\n 'main-thread:gesture': gesture,\n } = props\n // generates binding events dynamically\n const scrollViewRegisteredEvents = useRef<Record<string, string>>({\n ...ScrollEventsMapping,\n ...ExposureEventsMapping,\n ...TouchEventsMapping,\n ...LayoutEventsMapping,\n ...ScrollViewEventMapping,\n })\n const normalizedLazyOptions: LazyOptions | undefined = lazyOptions\n ? { firstScreenItemCount: 1, ...lazyOptions }\n : undefined\n const registerEvents = useRegisteredEvents(\n props,\n scrollViewRegisteredEvents.current,\n )\n const normalizedStyle: CSSProperties = {\n zIndex: 0,\n ...style,\n }\n\n const isHorizontal = () => {\n return scrollOrientation ? scrollOrientation === 'horizontal' : horizontal\n }\n\n // Initialize bounceableProps\n let enableBounce = false\n let bounceableProps: BounceableBasicProps = { enableBounces: false }\n if (typeof bounceableOptions === 'boolean') {\n // Initialize the default value if the bounceableOptions is simply 'true' without specific options\n enableBounce = bounceableOptions\n bounceableProps = {\n enableBounces: enableBounce,\n singleSidedBounce: 'both',\n alwaysBouncing: true,\n validAnimationVersion: true,\n }\n } else if (typeof bounceableOptions === 'object') {\n enableBounce = bounceableOptions.enableBounces\n bounceableProps = bounceableOptions\n bounceableProps.singleSidedBounce = bounceableOptions.singleSidedBounce\n ?? 'both'\n bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true\n bounceableProps.validAnimationVersion =\n bounceableOptions.validAnimationVersion ?? true\n }\n // Only when the enableBounces is true and singleSidedBounce is set to 'iOSBounces' will it use default bounces effect on iOS.\n const platformBounces = enableBounce\n && bounceableProps?.singleSidedBounce === 'iOSBounces'\n\n const shouldEnableNested = () => {\n if (\n SystemInfo.platform === 'iOS' && scrollPropagationBehavior !== 'propagate'\n ) {\n return false\n }\n return true\n }\n\n const renderChildren = (\n children: ReactNode,\n lazyOptions: LazyOptions | undefined,\n ) => {\n if (!Array.isArray(children)) {\n return children\n }\n const lazy = lazyOptions?.enableLazy\n return children.map((item: ReactNode, index: number) => {\n if (lazy && index >= Number(lazyOptions?.firstScreenItemCount)) {\n return (\n <LazyComponent\n key={`${scrollviewId}_lazy_${index}`}\n scene={lazyOptions?.scene}\n pid={`pid_${index}`}\n estimatedStyle={lazyOptions?.estimatedItemStyle}\n top={lazyOptions?.exposureTop}\n bottom={lazyOptions?.exposureBottom}\n left={lazyOptions?.exposureLeft}\n right={lazyOptions?.exposureRight}\n >\n {item}\n </LazyComponent>\n )\n }\n return item\n })\n }\n\n // These props will be spread directly to <scroll-view> element. Make sure it's valid\n type ExtendedScrollViewElementProps = ScrollViewElementProps & {\n 'scroll-x': boolean\n 'scroll-y': boolean\n }\n const elementProps: ExtendedScrollViewElementProps & {\n 'enable-scroll-monitor': boolean\n 'scroll-monitor-tag'?: string\n 'main-thread:gesture'?: GestureKind\n 'enable-new-nested'?: boolean\n 'enable-nested-scroll'?: boolean\n 'temporary-nested-scroll-forward'?: ScrollViewProps[\n 'experimentalNestedScrollForward'\n ]\n 'temporary-nested-scroll-backward'?: ScrollViewProps[\n 'experimentalNestedScrollBackward'\n ]\n 'force-can-scroll'?: boolean\n 'ios-block-gesture-class'?: string\n 'ios-recognized-view-tag'?: number\n 'className'?: string\n 'style'?: CSSProperties\n 'bounces'?: boolean\n } = {\n 'id': scrollviewId,\n 'scroll-x': isHorizontal(),\n 'scroll-y': !isHorizontal(),\n 'enable-scroll-monitor': enableScrollMonitor,\n 'scroll-monitor-tag': scrollMonitorTag,\n 'main-thread:gesture': gesture,\n 'force-can-scroll': scrollPropagationBehavior === 'preventPropagate',\n 'ios-block-gesture-class': scrollPropagationBehavior === 'preventPropagate'\n ? temporaryBlockScrollClass\n : '',\n 'ios-recognized-view-tag': scrollPropagationBehavior === 'preventPropagate'\n ? temporaryBlockScrollTag\n : 0,\n 'enable-nested-scroll': SystemInfo.platform === 'Android'\n ? (temporaryNestedScroll ?? true)\n : shouldEnableNested(),\n 'enable-new-nested': true,\n 'className': className,\n 'style': normalizedStyle,\n 'bounces': platformBounces,\n 'enable-scroll': enableScroll,\n ...(androidTouchSlop !== undefined\n && { 'android-touch-slop': androidTouchSlop }),\n ...(experimentalNestedScrollForward !== undefined && {\n 'temporary-nested-scroll-forward': experimentalNestedScrollForward,\n }),\n ...(experimentalNestedScrollBackward !== undefined && {\n 'temporary-nested-scroll-backward': experimentalNestedScrollBackward,\n }),\n ...registerEvents,\n }\n\n if (\n enableBounce\n && bounceableProps.singleSidedBounce !== 'iOSBounces'\n && bounceableProps.singleSidedBounce !== 'none'\n ) {\n return (\n <ScrollViewWithBouncesHook\n elementProps={elementProps}\n bounceableOptions={bounceableProps}\n debugLog={debugLog}\n enableRTL={enableRTL}\n sticky={sticky}\n >\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewWithBouncesHook>\n )\n } else {\n return (\n <ScrollViewBasic elementProps={elementProps} sticky={sticky}>\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewBasic>\n )\n }\n}\n"],"names":["ScrollView","memo","forwardRef","ScrollViewImpl","ScrollViewEventMapping","props","_ref","scrollviewId","horizontal","style","children","scrollOrientation","lazyOptions","className","debugLog","enableRTL","bounceableOptions","enableScroll","enableScrollMonitor","scrollMonitorTag","sticky","scrollPropagationBehavior","temporaryBlockScrollClass","temporaryBlockScrollTag","temporaryNestedScroll","experimentalNestedScrollForward","experimentalNestedScrollBackward","androidTouchSlop","gesture","scrollViewRegisteredEvents","useRef","ScrollEventsMapping","ExposureEventsMapping","TouchEventsMapping","LayoutEventsMapping","normalizedLazyOptions","undefined","registerEvents","useRegisteredEvents","normalizedStyle","isHorizontal","enableBounce","bounceableProps","platformBounces","shouldEnableNested","SystemInfo","renderChildren","Array","lazy","item","index","Number","LazyComponent","elementProps","ScrollViewWithBouncesHook","ScrollViewBasic"],"mappings":";;;;;;;AAqCO,MAAMA,aAAaC,KAAKC,WAAWC;AAE1C,MAAMC,y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S,WAArBT,oBACC;YAAE,sBAAsBA;QAAiB,CAAC;QAC/C,GAAIF,AAAoCW,WAApCX,mCAAiD;YACnD,mCAAmCA;QACrC,CAAC;QACD,GAAIC,AAAqCU,WAArCV,oCAAkD;YACpD,oCAAoCA;QACtC,CAAC;QACD,GAAGW,cAAc;IACnB;IAEA,IACEI,gBACGC,AAAsC,iBAAtCA,gBAAgB,iBAAiB,IACjCA,AAAsC,WAAtCA,gBAAgB,iBAAiB,EAEpC,QACGY,0BACC,cAAcD,cACd,mBAAmBX,iBACnB,UAAU5B,UACV,WAAWC,WACX,QAAQK,QACT;QACC,CAAC0B,eAAepC,UAAUyB,uBAAuB;MACnD,EAAEmB;IAGJ,QACGC,gBAAgB,cAAcF,cAAc,QAAQjC,QAAQ;QAC3D,CAAC0B,eAAepC,UAAUyB,uBAAuB;MACnD,EAAEoB;AAGR"}
1
+ {"version":3,"file":"index.jsx","sources":["../src/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { forwardRef, memo, useRef } from '@lynx-js/react'\nimport type { ForwardedRef, ReactNode } from '@lynx-js/react'\n\nimport '@lynx-js/gesture-runtime'\nimport type { GestureKind } from '@lynx-js/gesture-runtime'\nimport type { LazyOptions } from '@lynx-js/lynx-ui-common'\nimport {\n ExposureEventsMapping,\n LayoutEventsMapping,\n ScrollEventsMapping,\n TouchEventsMapping,\n useRegisteredEvents,\n} from '@lynx-js/lynx-ui-common'\nimport { LazyComponent } from '@lynx-js/lynx-ui-lazy-component'\nimport type {\n CSSProperties,\n ScrollViewProps as ScrollViewElementProps,\n} from '@lynx-js/types'\n\nimport ScrollViewBasic from './ScrollViewBasic'\nimport ScrollViewWithBouncesHook from './ScrollViewWithBouncesHook'\nimport type {\n BounceableBasicProps,\n ScrollViewProps,\n ScrollViewRef,\n ScrollView as ScrollViewType,\n} from './types'\n\nexport type { ScrollViewProps, ScrollViewRef }\nexport { useBounce } from './hooks/useBounce'\nexport type { bounceHandlers } from './hooks/useBounce'\nexport type { BounceableBasicProps } from './types'\n\nexport const ScrollView = memo(forwardRef(ScrollViewImpl)) as ScrollViewType\n\nconst ScrollViewEventMapping: Record<string, string> = {\n onContentSizeChange: 'bindcontentsizechanged',\n onWheel: 'bindwheel',\n}\n\n/**\n * @example\n * ```javascript\n * <ScrollView\n scene={`viewpager_${index1}`}\n style={{ width: '100%', height: '100%' }}\n estimatedItemStyle={{ width: '100%', height: '800px' }}\n scrollOrientation='vertical'\n exposureRight=\"50px\"\n exposureBottom=\"220px\"\n >\n {scrollview.map((item, index) => (\n <view\n style={`width:100%;height:580rpx;`}\n >\n <text>{`slot-${index}`}</text>\n </view>\n ))}\n </ScrollView>\n * ```\n */\nfunction ScrollViewImpl(\n props: ScrollViewProps,\n _ref: ForwardedRef<ScrollViewRef>,\n) {\n const {\n scrollviewId = 'scrollview',\n horizontal = false,\n style,\n children,\n scrollOrientation,\n lazyOptions,\n className = '',\n debugLog = false,\n enableRTL = false,\n bounceableOptions = {\n enableBounces: true,\n singleSidedBounce: 'iOSBounces',\n },\n enableScroll = true,\n enableScrollMonitor = false,\n scrollMonitorTag,\n sticky,\n scrollPropagationBehavior = 'native',\n temporaryBlockScrollClass = 'BDXLynxViewPager',\n temporaryBlockScrollTag = 0,\n temporaryNestedScroll,\n experimentalNestedScrollForward,\n experimentalNestedScrollBackward,\n androidTouchSlop,\n 'main-thread:gesture': gesture,\n } = props\n // generates binding events dynamically\n const scrollViewRegisteredEvents = useRef<Record<string, string>>({\n ...ScrollEventsMapping,\n ...ExposureEventsMapping,\n ...TouchEventsMapping,\n ...LayoutEventsMapping,\n ...ScrollViewEventMapping,\n })\n const normalizedLazyOptions: LazyOptions | undefined = lazyOptions\n ? { firstScreenItemCount: 1, ...lazyOptions }\n : undefined\n const registerEvents = useRegisteredEvents(\n props,\n scrollViewRegisteredEvents.current,\n )\n const normalizedStyle: CSSProperties = {\n zIndex: 0,\n ...style,\n }\n\n const isHorizontal = () => {\n return scrollOrientation ? scrollOrientation === 'horizontal' : horizontal\n }\n\n // Initialize bounceableProps\n let enableBounce = false\n let bounceableProps: BounceableBasicProps = { enableBounces: false }\n if (typeof bounceableOptions === 'boolean') {\n // Initialize the default value if the bounceableOptions is simply 'true' without specific options\n enableBounce = bounceableOptions\n bounceableProps = {\n enableBounces: enableBounce,\n singleSidedBounce: 'both',\n alwaysBouncing: true,\n validAnimationVersion: true,\n }\n } else if (typeof bounceableOptions === 'object') {\n enableBounce = bounceableOptions.enableBounces\n bounceableProps = bounceableOptions\n bounceableProps.singleSidedBounce = bounceableOptions.singleSidedBounce\n ?? 'both'\n bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true\n bounceableProps.validAnimationVersion =\n bounceableOptions.validAnimationVersion ?? true\n }\n // Only when the enableBounces is true and singleSidedBounce is set to 'iOSBounces' will it use default bounces effect on iOS.\n const platformBounces = enableBounce\n && bounceableProps?.singleSidedBounce === 'iOSBounces'\n\n const shouldEnableNested = () => {\n if (\n SystemInfo.platform === 'iOS' && scrollPropagationBehavior !== 'propagate'\n ) {\n return false\n }\n return true\n }\n\n const renderChildren = (\n children: ReactNode,\n lazyOptions: LazyOptions | undefined,\n ) => {\n if (!Array.isArray(children)) {\n return children\n }\n const lazy = lazyOptions?.enableLazy\n return children.map((item: ReactNode, index: number) => {\n if (lazy && index >= Number(lazyOptions?.firstScreenItemCount)) {\n return (\n <LazyComponent\n key={`${scrollviewId}_lazy_${index}`}\n scene={lazyOptions?.scene}\n pid={`pid_${index}`}\n estimatedStyle={lazyOptions?.estimatedItemStyle}\n top={lazyOptions?.exposureTop}\n bottom={lazyOptions?.exposureBottom}\n left={lazyOptions?.exposureLeft}\n right={lazyOptions?.exposureRight}\n >\n {item}\n </LazyComponent>\n )\n }\n return item\n })\n }\n\n // These props will be spread directly to <scroll-view> element. Make sure it's valid\n type ExtendedScrollViewElementProps = ScrollViewElementProps & {\n 'scroll-x': boolean\n 'scroll-y': boolean\n }\n const elementProps: ExtendedScrollViewElementProps & {\n 'enable-scroll-monitor': boolean\n 'scroll-monitor-tag'?: string\n 'main-thread:gesture'?: GestureKind\n 'enable-new-nested'?: boolean\n 'enable-nested-scroll'?: boolean\n 'temporary-nested-scroll-forward'?: ScrollViewProps[\n 'experimentalNestedScrollForward'\n ]\n 'temporary-nested-scroll-backward'?: ScrollViewProps[\n 'experimentalNestedScrollBackward'\n ]\n 'force-can-scroll'?: boolean\n 'ios-block-gesture-class'?: string\n 'ios-recognized-view-tag'?: number\n 'className'?: string\n 'style'?: CSSProperties\n 'bounces'?: boolean\n } = {\n 'id': scrollviewId,\n 'scroll-x': isHorizontal(),\n 'scroll-y': !isHorizontal(),\n 'enable-scroll-monitor': enableScrollMonitor,\n 'scroll-monitor-tag': scrollMonitorTag,\n 'main-thread:gesture': gesture,\n 'force-can-scroll': scrollPropagationBehavior === 'preventPropagate',\n 'ios-block-gesture-class': scrollPropagationBehavior === 'preventPropagate'\n ? temporaryBlockScrollClass\n : '',\n 'ios-recognized-view-tag': scrollPropagationBehavior === 'preventPropagate'\n ? temporaryBlockScrollTag\n : 0,\n 'enable-nested-scroll': SystemInfo.platform === 'Android'\n ? (temporaryNestedScroll ?? true)\n : shouldEnableNested(),\n 'enable-new-nested': true,\n 'className': className,\n 'style': normalizedStyle,\n 'bounces': platformBounces,\n 'enable-scroll': enableScroll,\n ...(androidTouchSlop !== undefined\n && { 'android-touch-slop': androidTouchSlop }),\n ...(experimentalNestedScrollForward !== undefined && {\n 'temporary-nested-scroll-forward': experimentalNestedScrollForward,\n }),\n ...(experimentalNestedScrollBackward !== undefined && {\n 'temporary-nested-scroll-backward': experimentalNestedScrollBackward,\n }),\n ...registerEvents,\n }\n\n if (\n enableBounce\n && bounceableProps.singleSidedBounce !== 'iOSBounces'\n && bounceableProps.singleSidedBounce !== 'none'\n ) {\n return (\n <ScrollViewWithBouncesHook\n elementProps={elementProps}\n bounceableOptions={bounceableProps}\n debugLog={debugLog}\n enableRTL={enableRTL}\n sticky={sticky}\n >\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewWithBouncesHook>\n )\n } else {\n return (\n <ScrollViewBasic elementProps={elementProps} sticky={sticky}>\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewBasic>\n )\n }\n}\n"],"names":["ScrollView","memo","forwardRef","ScrollViewImpl","ScrollViewEventMapping","props","_ref","scrollviewId","horizontal","style","children","scrollOrientation","lazyOptions","className","debugLog","enableRTL","bounceableOptions","enableScroll","enableScrollMonitor","scrollMonitorTag","sticky","scrollPropagationBehavior","temporaryBlockScrollClass","temporaryBlockScrollTag","temporaryNestedScroll","experimentalNestedScrollForward","experimentalNestedScrollBackward","androidTouchSlop","gesture","scrollViewRegisteredEvents","useRef","ScrollEventsMapping","ExposureEventsMapping","TouchEventsMapping","LayoutEventsMapping","normalizedLazyOptions","undefined","registerEvents","useRegisteredEvents","normalizedStyle","isHorizontal","enableBounce","bounceableProps","platformBounces","shouldEnableNested","SystemInfo","renderChildren","Array","lazy","item","index","Number","LazyComponent","elementProps","ScrollViewWithBouncesHook","ScrollViewBasic"],"mappings":";;;;;;AAqCO,MAAMA,aAAaC,KAAKC,WAAWC;AAE1C,MAAMC,yBAAiD;IACrD,qBAAqB;IACrB,SAAS;AACX;AAuBA,SAASD,eACPE,KAAsB,EACtBC,IAAiC;IAEjC,MAAM,EACJC,eAAe,YAAY,EAC3BC,aAAa,KAAK,EAClBC,KAAK,EACLC,QAAQ,EACRC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EAAE,EACdC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjBC,oBAAoB;QAClB,eAAe;QACf,mBAAmB;IACrB,CAAC,EACDC,eAAe,IAAI,EACnBC,sBAAsB,KAAK,EAC3BC,gBAAgB,EAChBC,MAAM,EACNC,4BAA4B,QAAQ,EACpCC,4BAA4B,kBAAkB,EAC9CC,0BAA0B,CAAC,EAC3BC,qBAAqB,EACr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AcF,cAAc,QAAQjC,QAAQ;QAC3D,CAAC0B,eAAepC,UAAUyB,uBAAuB;MACnD,EAAEoB;AAGR"}
@@ -1 +1 @@
1
- {"version":3,"file":"types/index.docs.jsx","sources":["webpack://@lynx-js/lynx-ui-scroll-view/./src/types/index.docs.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement, ReactNode } from '@lynx-js/react'\n\nimport type { BaseGesture } from '@lynx-js/gesture-runtime'\nimport type {\n BaseScrollEvents,\n BaseUIExposureEvents,\n BaseUIExposureProps,\n BaseUILayoutEvents,\n BaseUITouchEvents,\n ComponentBasicProps,\n LazyOptions,\n} from '@lynx-js/lynx-ui-common'\nimport type { CSSProperties, CommonEvent } from '@lynx-js/types'\n\nexport type ScrollView = (props: ScrollViewProps) => ReactElement\n\ntype ScrollPropagationBehaviorOption =\n | 'native' // Follows platform default behavior\n | 'propagate' // Always allow scroll propagation\n // | 'propagateAtEdge' // @todo Child scrolls first; parent scrolls on next touch at edge\n | 'preventPropagate' // Never allow scroll propagation\n\n// biome-ignore lint/suspicious/noEmptyInterface: <explanation>\nexport interface ScrollViewRef {}\n\nexport interface ScrollViewProps\n extends\n BaseUITouchEvents,\n BaseScrollEvents,\n BaseUIExposureEvents,\n BaseUILayoutEvents,\n BaseUIExposureProps,\n ComponentBasicProps\n{\n /**\n * The id of the scrollview.\n * @zh 滚动视图的id。\n * @defaultValue \"scrollview\"\n * @Android\n * @iOS\n */\n scrollviewId?: string\n /**\n * Enable scroll interaction.\n * @zh 启用滚动。\n * @defaultValue true\n * @Android\n * @iOS\n * @Harmony\n */\n enableScroll?: boolean\n /**\n * Open the bouncing effect on iOS. If you want to use it on Android, please refer to the bounceableOption. If the bounceableOption is set, the iOSBounces property will be invalid.\n * @zh 开启iOS上的回弹效果。如果想在安卓上使用,请参考bounceableOption。如果设置了bounceableOption,iOSBounces属性将失效。\n * @defaultValue true\n * @Android\n * @iOS\n */\n iOSBounces?: boolean\n /**\n * Testing Mode.\n * @zh 测试模式\n * @Android\n * @iOS\n */\n testing?: boolean\n /**\n * Be used to mark the exposure timing of lazy loading. Please ensure that it is unique throughout the page.\n * @zh 用于标记懒加载的曝光时机。请确保页面中唯一。\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n scene?: string\n /**\n * Horizontal scroll.\n * @zh 水平滚动。\n * @deprecated 3.119. Use scrollOrientation instead.\n * @Android\n * @iOS\n */\n horizontal?: boolean\n /**\n * Set to 'vertical' for vertical scrolling and set to 'horizontal' for horizontal scrolling.\n * @zh 设置为 'vertical' 为垂直滚动,设置为 'horizontal' 为水平滚动。\n * @defaultValue 'vertical'\n * @since 3.119\n * @iOS\n * @Android\n * @Harmony\n */\n scrollOrientation?: 'vertical' | 'horizontal'\n /**\n * When enabled, only the items that are about to enter the viewport are rendered, reducing initial load time and memory usage; remaining items are rendered as they approach visibility during scroll.\n * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。\n * @defaultValue true\n * @Android\n * @iOS\n */\n lazyOptions?: LazyOptions\n /**\n * Estimated height and width of the items need to be set.\n * @zh 需要设置 items 的预计高度和宽度。\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n estimatedItemStyle?: CSSProperties\n /**\n * When enabled, only the items that are about to enter the viewport are rendered, reducing initial load time and memory usage; remaining items are rendered as they approach visibility during scroll.\n * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。\n * @defaultValue true\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n lazy?: boolean\n /**\n * Sticky item, designed for `Tabs`.\n * @zh 粘性元素,设计用于 `Tabs`。\n * @Android\n * @iOS\n */\n sticky?: ReactElement\n /**\n * Children in scroll-view.\n * @zh `scroll-view` 的子元素。\n * @Android\n * @iOS\n */\n children?: ReactNode\n /**\n * exposure-screen-margin-top\n * @zh 曝光屏幕上方边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureTop?: string\n /**\n * exposure-screen-margin-bottom\n * @zh 曝光屏幕下方边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureBottom?: string\n /**\n * exposure-screen-margin-left\n * @zh 曝光屏幕左侧边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureLeft?: string\n /**\n * exposure-screen-margin-right\n * @zh 曝光屏幕右侧边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureRight?: string\n /**\n * Enable scroll monitor.\n * @zh 启用滚动监控。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n enableScrollMonitor?: boolean\n /**\n * The tag for scroll monitor.\n * @zh 滚动监控的标签。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n scrollMonitorTag?: string\n /**\n * Estimated first screen item count for lazy rendering. Remaining children will complete rendering based on exposure. When this estimate is small, it may cause a blank screen phenomenon where some nodes exist on the first screen.\n * @zh 懒加载时预计的第一页项数。剩余的子元素会基于曝光状态完成渲染。当此预估较小时,可能会导致第一屏出现空白现象。\n * @defaultValue 1\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n firstScreenItemCount?: number\n /**\n * Enable bouncing effect\n * @zh 启用弹性效果\n * @Android\n * @iOS\n * @deprecated Please use bounceableOptions instead.\n */\n bounceable?: boolean\n /**\n * Props for bouncing effect\n * @zh 弹性效果的参数\n * @defaultValue { enableBounces: true, singleSidedBounce: \"iOSBounces\" },\n * @Android\n * @iOS\n */\n bounceableOptions?: boolean | BounceableBasicProps\n /**\n * Whether horizontal bounce direction should be mirrored in RTL mode.\n * @zh 是否在 RTL 模式下镜像水平回弹方向。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n enableRTL?: boolean\n /**\n * Display debug logs for bounce interactions.\n * @zh 显示回弹交互的调试日志。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n debugLog?: boolean\n /**\n * Controls whether scroll events propagate to parent containers. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 控制滚动事件是否向父级容器传递。'preventPropagate' 在 iOS 上暂时需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * @experimental Currently, this property has limitations because its full functionality depends on a higher native SDK version: on iOS, `propagate` only works if both the parent and this component are set to` propagate` and `useRefactorList={true}` does not support 'propagate'. On Android, `preventPropagate` only functions when the parent is `x-swiper` or `x-viewpager-ng`.\n * @defaultValue 'native'\n * @iOS\n * @Android\n */\n scrollPropagationBehavior?: ScrollPropagationBehaviorOption\n /**\n * The specific class name of the container that is blocked when 'scrollPropagationBehavior' is set to be 'preventPropagate', must be informed by the container provider. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 当 scrollPropagationBehavior 设为 'preventPropagate' 时,被阻止滚动的容器的具体类名。'preventPropagate' 需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * This is a temporary props and will be deprecated on new Lynx SDK version.\n * @defaultValue 'BDXLynxViewPager'\n * @iOS\n */\n temporaryBlockScrollClass?: string\n /**\n * Used to specify the native container tag that is blocked when 'scrollPropagationBehavior' is set to be 'preventPropagate', corresponding to the Tag attribute of UIView. Needs to be specified by the native container provider. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 用于指定当 scrollPropagationBehavior 设为 'preventPropagate' 时被阻止滚动的原生容器标签(对应 UIView 的 Tag 属性)。该值需由原生容器提供方指定,且 'preventPropagate' 必须与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * This is a temporary props and will be deprecated on new Lynx SDK version.\n * @defaultValue 0\n * @iOS\n */\n temporaryBlockScrollTag?: number\n /**\n * Android-only temporary flag to control nested scroll; maps to native 'enable-nested-scroll'. Android default value is true.\n * @zh 仅 Android 生效的临时开关,用于控制嵌套滚动冲突;映射到原生属性 'enable-nested-scroll'。Android上默认开启。\n * @Android\n */\n temporaryNestedScroll?: boolean\n /**\n * If you want to use gesture, pass it here.\n * @zh 如果想使用 gesture API,请传入该属性。\n * @iOS\n * @Android\n */\n 'main-thread:gesture'?: BaseGesture\n\n /**\n * Adapts Harmony nested scroll behavior. 'selfOnly' scrolls only this component. 'selfFirst' scrolls this component first, then the parent after this component reaches a scroll boundary. 'parentFirst' scrolls the parent first, then this component after the parent reaches a scroll boundary. 'parallel' scrolls this component and the parent at the same time.\n * @zh 适配 Harmony 的嵌套滚动行为。'selfOnly' 表示只自身滚动,不与父组件联动。'selfFirst' 表示自身先滚动,自身滚动到边界以后父组件滚动。'parentFirst' 表示父组件先滚动,父组件滚动到边界以后自身滚动。'parallel' 表示自身和父组件同时滚动。\n * @Harmony\n */\n experimentalNestedScrollForward?:\n | 'selfOnly'\n | 'selfFirst'\n | 'parentFirst'\n | 'parallel'\n\n /**\n * Adapts Harmony nested scroll behavior. 'selfOnly' scrolls only this component. 'selfFirst' scrolls this component first, then the parent after this component reaches a scroll boundary. 'parentFirst' scrolls the parent first, then this component after the parent reaches a scroll boundary. 'parallel' scrolls this component and the parent at the same time.\n * @zh 适配 Harmony 的嵌套滚动行为。'selfOnly' 表示只自身滚动,不与父组件联动。'selfFirst' 表示自身先滚动,自身滚动到边界以后父组件滚动。'parentFirst' 表示父组件先滚动,父组件滚动到边界以后自身滚动。'parallel' 表示自身和父组件同时滚动。\n * @Harmony\n */\n experimentalNestedScrollBackward?:\n | 'selfOnly'\n | 'selfFirst'\n | 'parentFirst'\n | 'parallel'\n\n /**\n * Android touch recognition mode. When inside a component that supports 'paging' mode, 'paging' must be enabled.\n * @zh Android 触摸识别模式,当处于支持 'paging' 模式的元件中时,需要开启 'paging' 模式。\n * @Android\n */\n androidTouchSlop?: 'default' | 'paging'\n\n /**\n * Being triggered when scrolling content changes.\n * @zh 滚动内容变化时触发。\n * @eventProperty\n * @Android\n * @iOS\n */\n onContentSizeChange?: (res: {\n detail: { scrollWidth: number, scrollHeight: number }\n }) => void\n /**\n * Send when a wheel event is triggered on the scroll-view.\n * @zh 当 scroll-view 触发滚轮事件时发送。\n * @eventProperty\n * @PC\n * @Web\n */\n onWheel?: (e: CommonEvent) => void\n}\n\nexport interface scrollToBouncesInfo {\n direction: 'upper' | 'lower'\n}\n\nexport interface BounceableBasicProps {\n /**\n * Whether to enable bounce effect\n * @zh 是否开启回弹效果\n * @iOS\n * @Android\n * @Harmony\n */\n enableBounces: boolean\n /**\n * Trigger bounces effect during fling\n * @zh 在快速滑动(fling)时触发回弹效果\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n enableBounceEventInFling?: boolean\n /**\n * The threshold distance of upper bounces, in pixels, when triggering the scrollToBounces event\n * @zh 触发 `scrollToBounces` 事件时,上部回弹的阈值距离(单位:px)\n * @defaultValue 0\n * @iOS\n * @Android\n * @Harmony\n */\n startBounceTriggerDistance?: number\n /**\n * The threshold distance of lower bounces, in pixels, when triggering the scrollToBounces event\n * @zh 触发 `scrollToBounces` 事件时,下部回弹的阈值距离(单位:px)\n * @defaultValue 0\n * @iOS\n * @Android\n * @Harmony\n */\n endBounceTriggerDistance?: number\n /**\n * Content of upper bounces view, which will be displayed during the upper bouncing effect.\n * @zh 上部回弹视图的内容,将在上部回弹效果期间显示。\n * @iOS\n * @Android\n * @Harmony\n */\n // biome-ignore lint/suspicious/noExplicitAny: expected\n upperBounceItem?: any\n /**\n * Content of lower bounces view, which will be displayed during the lower bouncing effect.\n * @zh 下部回弹视图的内容,将在下部回弹效果期间显示。\n * @iOS\n * @Android\n * @Harmony\n */\n // biome-ignore lint/suspicious/noExplicitAny: expected\n lowerBounceItem?: any\n /**\n * Whether the scrollable container can bounce when the content area of the scrollable container is smaller than the viewport area.\n * @zh 当可滚动容器的内容区域小于视口区域时,是否允许容器回弹。\n * @defaultValue true\n * @iOS\n * @Android\n * @Harmony\n */\n alwaysBouncing?: boolean\n /**\n * The direction of the bounce effect. 'both' for bouncing on both ends, 'none' to disable bounce, and 'upper'/'lower' for bouncing on either end\n * @zh 回弹效果的方向。'both' 表示两端都回弹,'none' 表示禁用回弹,'upper'/'lower' 表示只在上端或下端回弹。\n * @defaultValue 'both'\n * @iOS\n * @Android\n * @Harmony\n */\n singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'\n /**\n * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.\n * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。\n * @Android\n * @iOS\n * @Harmony\n */\n estimatedHeight?: number\n /**\n * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.\n * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。\n * @Android\n * @iOS\n * @Harmony\n */\n estimatedWidth?: number\n /**\n * requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.\n * @zh `requestAnimationFrame` 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n validAnimationVersion?: boolean\n /**\n * When bounces effect is triggered and the bounce distance is larger than startBounceDistance or endBounceDistance on the upper or lower side, the scrollToBounces event will be triggered.\n * @zh 当触发回弹效果并且回弹距离在上侧或下侧大于 `startBounceDistance` 或 `endBounceDistance` 时,将触发 `scrollToBounces` 事件。\n * @defaultValue 0\n * @eventProperty\n * @iOS\n * @Android\n * @Harmony\n */\n onScrollToBounces?: (e: scrollToBouncesInfo) => void\n}\n\nexport const ScrollEventMapping: Record<string, string> = {\n onContentSizeChange: 'bindcontentsizechange',\n}\n"],"names":["ScrollEventMapping"],"mappings":"AAibO,MAAMA,qBAA6C;IACxD,qBAAqB;AACvB"}
1
+ {"version":3,"file":"types/index.docs.jsx","sources":["../../src/types/index.docs.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement, ReactNode } from '@lynx-js/react'\n\nimport type { BaseGesture } from '@lynx-js/gesture-runtime'\nimport type {\n BaseScrollEvents,\n BaseUIExposureEvents,\n BaseUIExposureProps,\n BaseUILayoutEvents,\n BaseUITouchEvents,\n ComponentBasicProps,\n LazyOptions,\n} from '@lynx-js/lynx-ui-common'\nimport type { CSSProperties, CommonEvent } from '@lynx-js/types'\n\nexport type ScrollView = (props: ScrollViewProps) => ReactElement\n\ntype ScrollPropagationBehaviorOption =\n | 'native' // Follows platform default behavior\n | 'propagate' // Always allow scroll propagation\n // | 'propagateAtEdge' // @todo Child scrolls first; parent scrolls on next touch at edge\n | 'preventPropagate' // Never allow scroll propagation\n\n// biome-ignore lint/suspicious/noEmptyInterface: <explanation>\nexport interface ScrollViewRef {}\n\nexport interface ScrollViewProps\n extends\n BaseUITouchEvents,\n BaseScrollEvents,\n BaseUIExposureEvents,\n BaseUILayoutEvents,\n BaseUIExposureProps,\n ComponentBasicProps\n{\n /**\n * The id of the scrollview.\n * @zh 滚动视图的id。\n * @defaultValue \"scrollview\"\n * @Android\n * @iOS\n */\n scrollviewId?: string\n /**\n * Enable scroll interaction.\n * @zh 启用滚动。\n * @defaultValue true\n * @Android\n * @iOS\n * @Harmony\n */\n enableScroll?: boolean\n /**\n * Open the bouncing effect on iOS. If you want to use it on Android, please refer to the bounceableOption. If the bounceableOption is set, the iOSBounces property will be invalid.\n * @zh 开启iOS上的回弹效果。如果想在安卓上使用,请参考bounceableOption。如果设置了bounceableOption,iOSBounces属性将失效。\n * @defaultValue true\n * @Android\n * @iOS\n */\n iOSBounces?: boolean\n /**\n * Testing Mode.\n * @zh 测试模式\n * @Android\n * @iOS\n */\n testing?: boolean\n /**\n * Be used to mark the exposure timing of lazy loading. Please ensure that it is unique throughout the page.\n * @zh 用于标记懒加载的曝光时机。请确保页面中唯一。\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n scene?: string\n /**\n * Horizontal scroll.\n * @zh 水平滚动。\n * @deprecated 3.119. Use scrollOrientation instead.\n * @Android\n * @iOS\n */\n horizontal?: boolean\n /**\n * Set to 'vertical' for vertical scrolling and set to 'horizontal' for horizontal scrolling.\n * @zh 设置为 'vertical' 为垂直滚动,设置为 'horizontal' 为水平滚动。\n * @defaultValue 'vertical'\n * @since 3.119\n * @iOS\n * @Android\n * @Harmony\n */\n scrollOrientation?: 'vertical' | 'horizontal'\n /**\n * When enabled, only the items that are about to enter the viewport are rendered, reducing initial load time and memory usage; remaining items are rendered as they approach visibility during scroll.\n * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。\n * @defaultValue true\n * @Android\n * @iOS\n */\n lazyOptions?: LazyOptions\n /**\n * Estimated height and width of the items need to be set.\n * @zh 需要设置 items 的预计高度和宽度。\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n estimatedItemStyle?: CSSProperties\n /**\n * When enabled, only the items that are about to enter the viewport are rendered, reducing initial load time and memory usage; remaining items are rendered as they approach visibility during scroll.\n * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。\n * @defaultValue true\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n lazy?: boolean\n /**\n * Sticky item, designed for `Tabs`.\n * @zh 粘性元素,设计用于 `Tabs`。\n * @Android\n * @iOS\n */\n sticky?: ReactElement\n /**\n * Children in scroll-view.\n * @zh `scroll-view` 的子元素。\n * @Android\n * @iOS\n */\n children?: ReactNode\n /**\n * exposure-screen-margin-top\n * @zh 曝光屏幕上方边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureTop?: string\n /**\n * exposure-screen-margin-bottom\n * @zh 曝光屏幕下方边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureBottom?: string\n /**\n * exposure-screen-margin-left\n * @zh 曝光屏幕左侧边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureLeft?: string\n /**\n * exposure-screen-margin-right\n * @zh 曝光屏幕右侧边距\n * @defaultValue '10px'\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n exposureRight?: string\n /**\n * Enable scroll monitor.\n * @zh 启用滚动监控。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n enableScrollMonitor?: boolean\n /**\n * The tag for scroll monitor.\n * @zh 滚动监控的标签。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n scrollMonitorTag?: string\n /**\n * Estimated first screen item count for lazy rendering. Remaining children will complete rendering based on exposure. When this estimate is small, it may cause a blank screen phenomenon where some nodes exist on the first screen.\n * @zh 懒加载时预计的第一页项数。剩余的子元素会基于曝光状态完成渲染。当此预估较小时,可能会导致第一屏出现空白现象。\n * @defaultValue 1\n * @Android\n * @iOS\n * @deprecated Please use lazyOptions instead.\n */\n firstScreenItemCount?: number\n /**\n * Enable bouncing effect\n * @zh 启用弹性效果\n * @Android\n * @iOS\n * @deprecated Please use bounceableOptions instead.\n */\n bounceable?: boolean\n /**\n * Props for bouncing effect\n * @zh 弹性效果的参数\n * @defaultValue { enableBounces: true, singleSidedBounce: \"iOSBounces\" },\n * @Android\n * @iOS\n */\n bounceableOptions?: boolean | BounceableBasicProps\n /**\n * Whether horizontal bounce direction should be mirrored in RTL mode.\n * @zh 是否在 RTL 模式下镜像水平回弹方向。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n enableRTL?: boolean\n /**\n * Display debug logs for bounce interactions.\n * @zh 显示回弹交互的调试日志。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n debugLog?: boolean\n /**\n * Controls whether scroll events propagate to parent containers. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 控制滚动事件是否向父级容器传递。'preventPropagate' 在 iOS 上暂时需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * @experimental Currently, this property has limitations because its full functionality depends on a higher native SDK version: on iOS, `propagate` only works if both the parent and this component are set to` propagate` and `useRefactorList={true}` does not support 'propagate'. On Android, `preventPropagate` only functions when the parent is `x-swiper` or `x-viewpager-ng`.\n * @defaultValue 'native'\n * @iOS\n * @Android\n */\n scrollPropagationBehavior?: ScrollPropagationBehaviorOption\n /**\n * The specific class name of the container that is blocked when 'scrollPropagationBehavior' is set to be 'preventPropagate', must be informed by the container provider. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 当 scrollPropagationBehavior 设为 'preventPropagate' 时,被阻止滚动的容器的具体类名。'preventPropagate' 需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * This is a temporary props and will be deprecated on new Lynx SDK version.\n * @defaultValue 'BDXLynxViewPager'\n * @iOS\n */\n temporaryBlockScrollClass?: string\n /**\n * Used to specify the native container tag that is blocked when 'scrollPropagationBehavior' is set to be 'preventPropagate', corresponding to the Tag attribute of UIView. Needs to be specified by the native container provider. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.\n * @zh 用于指定当 scrollPropagationBehavior 设为 'preventPropagate' 时被阻止滚动的原生容器标签(对应 UIView 的 Tag 属性)。该值需由原生容器提供方指定,且 'preventPropagate' 必须与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。\n * This is a temporary props and will be deprecated on new Lynx SDK version.\n * @defaultValue 0\n * @iOS\n */\n temporaryBlockScrollTag?: number\n /**\n * Android-only temporary flag to control nested scroll; maps to native 'enable-nested-scroll'. Android default value is true.\n * @zh 仅 Android 生效的临时开关,用于控制嵌套滚动冲突;映射到原生属性 'enable-nested-scroll'。Android上默认开启。\n * @Android\n */\n temporaryNestedScroll?: boolean\n /**\n * If you want to use gesture, pass it here.\n * @zh 如果想使用 gesture API,请传入该属性。\n * @iOS\n * @Android\n */\n 'main-thread:gesture'?: BaseGesture\n\n /**\n * Adapts Harmony nested scroll behavior. 'selfOnly' scrolls only this component. 'selfFirst' scrolls this component first, then the parent after this component reaches a scroll boundary. 'parentFirst' scrolls the parent first, then this component after the parent reaches a scroll boundary. 'parallel' scrolls this component and the parent at the same time.\n * @zh 适配 Harmony 的嵌套滚动行为。'selfOnly' 表示只自身滚动,不与父组件联动。'selfFirst' 表示自身先滚动,自身滚动到边界以后父组件滚动。'parentFirst' 表示父组件先滚动,父组件滚动到边界以后自身滚动。'parallel' 表示自身和父组件同时滚动。\n * @Harmony\n */\n experimentalNestedScrollForward?:\n | 'selfOnly'\n | 'selfFirst'\n | 'parentFirst'\n | 'parallel'\n\n /**\n * Adapts Harmony nested scroll behavior. 'selfOnly' scrolls only this component. 'selfFirst' scrolls this component first, then the parent after this component reaches a scroll boundary. 'parentFirst' scrolls the parent first, then this component after the parent reaches a scroll boundary. 'parallel' scrolls this component and the parent at the same time.\n * @zh 适配 Harmony 的嵌套滚动行为。'selfOnly' 表示只自身滚动,不与父组件联动。'selfFirst' 表示自身先滚动,自身滚动到边界以后父组件滚动。'parentFirst' 表示父组件先滚动,父组件滚动到边界以后自身滚动。'parallel' 表示自身和父组件同时滚动。\n * @Harmony\n */\n experimentalNestedScrollBackward?:\n | 'selfOnly'\n | 'selfFirst'\n | 'parentFirst'\n | 'parallel'\n\n /**\n * Android touch recognition mode. When inside a component that supports 'paging' mode, 'paging' must be enabled.\n * @zh Android 触摸识别模式,当处于支持 'paging' 模式的元件中时,需要开启 'paging' 模式。\n * @Android\n */\n androidTouchSlop?: 'default' | 'paging'\n\n /**\n * Being triggered when scrolling content changes.\n * @zh 滚动内容变化时触发。\n * @eventProperty\n * @Android\n * @iOS\n */\n onContentSizeChange?: (res: {\n detail: { scrollWidth: number, scrollHeight: number }\n }) => void\n /**\n * Send when a wheel event is triggered on the scroll-view.\n * @zh 当 scroll-view 触发滚轮事件时发送。\n * @eventProperty\n * @PC\n * @Web\n */\n onWheel?: (e: CommonEvent) => void\n}\n\nexport interface scrollToBouncesInfo {\n direction: 'upper' | 'lower'\n}\n\nexport interface BounceableBasicProps {\n /**\n * Whether to enable bounce effect\n * @zh 是否开启回弹效果\n * @iOS\n * @Android\n * @Harmony\n */\n enableBounces: boolean\n /**\n * Trigger bounces effect during fling\n * @zh 在快速滑动(fling)时触发回弹效果\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n enableBounceEventInFling?: boolean\n /**\n * The threshold distance of upper bounces, in pixels, when triggering the scrollToBounces event\n * @zh 触发 `scrollToBounces` 事件时,上部回弹的阈值距离(单位:px)\n * @defaultValue 0\n * @iOS\n * @Android\n * @Harmony\n */\n startBounceTriggerDistance?: number\n /**\n * The threshold distance of lower bounces, in pixels, when triggering the scrollToBounces event\n * @zh 触发 `scrollToBounces` 事件时,下部回弹的阈值距离(单位:px)\n * @defaultValue 0\n * @iOS\n * @Android\n * @Harmony\n */\n endBounceTriggerDistance?: number\n /**\n * Content of upper bounces view, which will be displayed during the upper bouncing effect.\n * @zh 上部回弹视图的内容,将在上部回弹效果期间显示。\n * @iOS\n * @Android\n * @Harmony\n */\n // biome-ignore lint/suspicious/noExplicitAny: expected\n upperBounceItem?: any\n /**\n * Content of lower bounces view, which will be displayed during the lower bouncing effect.\n * @zh 下部回弹视图的内容,将在下部回弹效果期间显示。\n * @iOS\n * @Android\n * @Harmony\n */\n // biome-ignore lint/suspicious/noExplicitAny: expected\n lowerBounceItem?: any\n /**\n * Whether the scrollable container can bounce when the content area of the scrollable container is smaller than the viewport area.\n * @zh 当可滚动容器的内容区域小于视口区域时,是否允许容器回弹。\n * @defaultValue true\n * @iOS\n * @Android\n * @Harmony\n */\n alwaysBouncing?: boolean\n /**\n * The direction of the bounce effect. 'both' for bouncing on both ends, 'none' to disable bounce, and 'upper'/'lower' for bouncing on either end\n * @zh 回弹效果的方向。'both' 表示两端都回弹,'none' 表示禁用回弹,'upper'/'lower' 表示只在上端或下端回弹。\n * @defaultValue 'both'\n * @iOS\n * @Android\n * @Harmony\n */\n singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'\n /**\n * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.\n * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。\n * @Android\n * @iOS\n * @Harmony\n */\n estimatedHeight?: number\n /**\n * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.\n * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。\n * @Android\n * @iOS\n * @Harmony\n */\n estimatedWidth?: number\n /**\n * requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.\n * @zh `requestAnimationFrame` 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。\n * @defaultValue false\n * @iOS\n * @Android\n * @Harmony\n */\n validAnimationVersion?: boolean\n /**\n * When bounces effect is triggered and the bounce distance is larger than startBounceDistance or endBounceDistance on the upper or lower side, the scrollToBounces event will be triggered.\n * @zh 当触发回弹效果并且回弹距离在上侧或下侧大于 `startBounceDistance` 或 `endBounceDistance` 时,将触发 `scrollToBounces` 事件。\n * @defaultValue 0\n * @eventProperty\n * @iOS\n * @Android\n * @Harmony\n */\n onScrollToBounces?: (e: scrollToBouncesInfo) => void\n}\n\nexport const ScrollEventMapping: Record<string, string> = {\n onContentSizeChange: 'bindcontentsizechange',\n}\n"],"names":["ScrollEventMapping"],"mappings":"AAibO,MAAMA,qBAA6C;IACxD,qBAAqB;AACvB"}
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/lynx-ui-scroll-view",
3
- "version": "3.135.3",
3
+ "version": "3.136.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-family/lynx-ui.git",
@@ -26,15 +26,15 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@lynx-js/gesture-runtime": "2.1.1",
29
- "@lynx-js/lynx-ui-common": "3.135.3",
30
- "@lynx-js/lynx-ui-lazy-component": "3.135.3"
29
+ "@lynx-js/lynx-ui-common": "3.136.0",
30
+ "@lynx-js/lynx-ui-lazy-component": "3.136.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@lynx-js/react": "0.114.0",
34
- "@lynx-js/types": "3.6.0",
35
- "@rslib/core": "^0.16.0",
33
+ "@lynx-js/react": "0.123.1",
34
+ "@lynx-js/types": "4.1.0",
35
+ "@rslib/core": "0.23.2",
36
36
  "@types/react": "^18.3.8",
37
- "typescript": "^5.5.3"
37
+ "typescript": "^5.8.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@lynx-js/react": ">=0.100.0",
package/tsconfig.json CHANGED
@@ -6,4 +6,9 @@
6
6
  "include": [
7
7
  "src",
8
8
  ],
9
+ "exclude": [
10
+ "**/*.test.ts",
11
+ "**/*.test.tsx",
12
+ "**/__tests__/**",
13
+ ],
9
14
  }