@lynx-js/lynx-ui-scroll-view 3.136.0 → 3.137.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,19 @@
1
1
  # @lynx-js/lynx-ui-scroll-view
2
2
 
3
+ ## 3.137.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add an `enableNewArch` option that defaults to `true` on Lynx SDK 4.3 and newer, and uses native scroll-view bounces across Android, iOS, and Harmony while preserving custom bounce items, threshold callbacks, stable overscroll alignment, and radius-aware clipping. ([#261](https://github.com/lynx-family/lynx-ui/pull/261))
8
+
9
+ ### Patch Changes
10
+
11
+ - Emit declaration imports with explicit ESM-compatible paths. ([#280](https://github.com/lynx-family/lynx-ui/pull/280))
12
+
13
+ - Updated dependencies [[`064ea4e`](https://github.com/lynx-family/lynx-ui/commit/064ea4e49cd3d0ac5754519cbee43d8ab3040024)]:
14
+ - @lynx-js/lynx-ui-common@3.137.0
15
+ - @lynx-js/lynx-ui-lazy-component@3.137.0
16
+
3
17
  ## 3.136.0
4
18
 
5
19
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  import type { ForwardedRef, ReactElement, ReactNode } from '@lynx-js/react';
2
2
  import '@lynx-js/gesture-runtime';
3
3
  import type { ScrollViewProps as ScrollViewElementProps } from '@lynx-js/types';
4
- import type { BounceableBasicProps, ScrollViewProps, ScrollViewRef } from './types';
4
+ import type { BounceableBasicProps, ScrollViewProps, ScrollViewRef } from './types/index.js';
5
5
  export type { ScrollViewProps, ScrollViewRef };
6
6
  declare function ScrollViewWithBouncesHook(props: {
7
7
  elementProps: ScrollViewElementProps;
@@ -9,6 +9,7 @@ declare function ScrollViewWithBouncesHook(props: {
9
9
  bounceableOptions?: BounceableBasicProps;
10
10
  debugLog?: boolean;
11
11
  enableRTL?: boolean;
12
+ nativeBounces?: boolean;
12
13
  sticky?: ReactElement;
13
14
  }, _ref: ForwardedRef<ScrollViewRef>): import("react").JSX.Element;
14
15
  export default ScrollViewWithBouncesHook;
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollViewWithBouncesHook.d.ts","sourceRoot":"","sources":["../src/ScrollViewWithBouncesHook.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAEV,eAAe,IAAI,sBAAsB,EAC1C,MAAM,gBAAgB,CAAA;AAGvB,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAE9C,iBAAS,yBAAyB,CAChC,KAAK,EAAE;IACL,YAAY,EAAE,sBAAsB,CAAA;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,iBAAiB,CAAC,EAAE,oBAAoB,CAAA;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB,EACD,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,+BAsIlC;AAED,eAAe,yBAAyB,CAAA"}
1
+ {"version":3,"file":"ScrollViewWithBouncesHook.d.ts","sourceRoot":"","sources":["../src/ScrollViewWithBouncesHook.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAEV,eAAe,IAAI,sBAAsB,EAC1C,MAAM,gBAAgB,CAAA;AAKvB,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAE9C,iBAAS,yBAAyB,CAChC,KAAK,EAAE;IACL,YAAY,EAAE,sBAAsB,CAAA;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,iBAAiB,CAAC,EAAE,oBAAoB,CAAA;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB,EACD,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,+BAiJlC;AAED,eAAe,yBAAyB,CAAA"}
@@ -1,10 +1,13 @@
1
1
  import "@lynx-js/gesture-runtime";
2
+ import { getBounceWrapperStyle } from "./bounceWrapperUtils.jsx";
2
3
  import { useBounce } from "./hooks/useBounce.jsx";
4
+ import { useNativeBounce } from "./hooks/useNativeBounce.jsx";
3
5
  function ScrollViewWithBouncesHook(props, _ref) {
4
- const { children, bounceableOptions, sticky, elementProps, debugLog = false, enableRTL = false } = props;
6
+ const { children, bounceableOptions, sticky, elementProps, debugLog = false, enableRTL = false, nativeBounces = false } = props;
5
7
  const horizontal = elementProps['scroll-x'] ?? false === elementProps['scroll-y'];
6
8
  const scrollViewId = elementProps.id;
7
9
  const { style } = elementProps;
10
+ const bounceWrapperStyle = getBounceWrapperStyle(style, Boolean(horizontal));
8
11
  let enableBounce = false;
9
12
  let bounceableProps = {
10
13
  enableBounces: false
@@ -32,6 +35,14 @@ function ScrollViewWithBouncesHook(props, _ref) {
32
35
  id: scrollViewId,
33
36
  scrollOrientation: horizontal ? 'horizontal' : 'vertical'
34
37
  });
38
+ const nativeBounceMTSProps = useNativeBounce({
39
+ bounceableOptions: bounceableProps,
40
+ debugLog,
41
+ enableRTL,
42
+ id: scrollViewId,
43
+ scrollOrientation: horizontal ? 'horizontal' : 'vertical'
44
+ });
45
+ const activeBounceMTSProps = nativeBounces ? nativeBounceMTSProps : bounceMTSProps;
35
46
  if (enableBounce) {
36
47
  if (bounceableProps.upperBounceItem) startBounceView = <view id={`${scrollViewId}-upperBounceWrapper`} style={`position:absolute;${horizontal ? enableRTL ? 'left:100%' : 'right:100%' : 'bottom:100%'}; ${horizontal ? 'height:100%;' : 'width:100%;'};${horizontal ? 'width:max-content' : 'height:max-content'};`} main-thread:gesture={elementProps['main-thread:gesture']}>
37
48
  {bounceableProps.upperBounceItem}
@@ -39,11 +50,11 @@ function ScrollViewWithBouncesHook(props, _ref) {
39
50
  if (bounceableProps.lowerBounceItem) endBounceView = <view id={`${scrollViewId}-lowerBounceWrapper`} style={`position:absolute;${horizontal ? enableRTL ? 'right:100%' : 'left:100%' : 'top:100%'}; ${horizontal ? 'height:100%;' : 'width:100%;'};${horizontal ? 'width:max-content' : 'height:max-content'};`} main-thread:gesture={elementProps['main-thread:gesture']}>
40
51
  {bounceableProps.lowerBounceItem}
41
52
  </view>;
42
- upperExposureView = <view style={`display: flex; flex-direction: column; overflow:hidden; height: ${horizontal ? '100%' : '1ppx'}; width: ${horizontal ? '1ppx' : '100%'};`} exposure-scene={scrollViewId} exposure-id='upperExposureView' id={`${scrollViewId}-upperExposureView`} main-thread:binduidisappear={bounceMTSProps.onUpperDisexposure} main-thread:binduiappear={bounceMTSProps.onUpperExposure} main-thread:gesture={elementProps['main-thread:gesture']}/>;
43
- lowerExposureView = <view style={`display: flex; flex-direction: column; overflow:hidden; height: ${horizontal ? '100%' : '1ppx'}; width: ${horizontal ? '1ppx' : '100%'};`} exposure-scene={scrollViewId} exposure-id='lowerExposureView' id={`${scrollViewId}-lowerExposureView`} main-thread:binduidisappear={bounceMTSProps.onLowerDisexposure} main-thread:binduiappear={bounceMTSProps.onLowerExposure} main-thread:gesture={elementProps['main-thread:gesture']}/>;
53
+ upperExposureView = !nativeBounces && <view style={`display: flex; flex-direction: column; overflow:hidden; height: ${horizontal ? '100%' : '1ppx'}; width: ${horizontal ? '1ppx' : '100%'};`} exposure-scene={scrollViewId} exposure-id='upperExposureView' id={`${scrollViewId}-upperExposureView`} main-thread:binduidisappear={bounceMTSProps.onUpperDisexposure} main-thread:binduiappear={bounceMTSProps.onUpperExposure} main-thread:gesture={elementProps['main-thread:gesture']}/>;
54
+ lowerExposureView = !nativeBounces && <view style={`display: flex; flex-direction: column; overflow:hidden; height: ${horizontal ? '100%' : '1ppx'}; width: ${horizontal ? '1ppx' : '100%'};`} exposure-scene={scrollViewId} exposure-id='lowerExposureView' id={`${scrollViewId}-lowerExposureView`} main-thread:binduidisappear={bounceMTSProps.onLowerDisexposure} main-thread:binduiappear={bounceMTSProps.onLowerExposure} main-thread:gesture={elementProps['main-thread:gesture']}/>;
44
55
  }
45
- return <view id={`${scrollViewId}-BounceWrapper`} style={`display: flex; flex-direction: column; overflow:hidden; height: ${horizontal ? '100%' : `${style?.height}`}; width: ${horizontal ? `${style?.width}` : '100%'};`} main-thread:gesture={elementProps['main-thread:gesture']}>
46
- <scroll-view {...elementProps} {...bounceMTSProps} bounces={false} ios-enable-simultaneous-touch={true} name={__LEPUS__ ? 'lepus' : 'background'}>
56
+ return <view id={`${scrollViewId}-BounceWrapper`} flatten={false} style={bounceWrapperStyle} main-thread:gesture={elementProps['main-thread:gesture']}>
57
+ <scroll-view {...elementProps} {...activeBounceMTSProps} bounces={nativeBounces} ios-enable-simultaneous-touch={true} name={__LEPUS__ ? 'lepus' : 'background'}>
47
58
  {upperExposureView}
48
59
  {sticky}
49
60
  {children}
@@ -1 +1 @@
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;QACr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BACZ,IAAI,GAAGA,aAAa,kBAAkB,CAAC,EACvC,YAAY,iBAAiBQ,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 { getBounceWrapperStyle } from './bounceWrapperUtils'\nimport { useBounce } from './hooks/useBounce'\nimport { useNativeBounce } from './hooks/useNativeBounce'\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 nativeBounces?: 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 nativeBounces = 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 const bounceWrapperStyle = getBounceWrapperStyle(style, Boolean(horizontal))\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 const nativeBounceMTSProps = useNativeBounce({\n bounceableOptions: bounceableProps,\n debugLog,\n enableRTL,\n id: scrollViewId,\n scrollOrientation: horizontal ? 'horizontal' : 'vertical',\n })\n const activeBounceMTSProps = nativeBounces\n ? nativeBounceMTSProps\n : bounceMTSProps\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 = !nativeBounces && (\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 = !nativeBounces && (\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 flatten={false}\n style={bounceWrapperStyle}\n main-thread:gesture={elementProps['main-thread:gesture']}\n >\n <scroll-view\n {...elementProps}\n {...activeBounceMTSProps}\n bounces={nativeBounces}\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","nativeBounces","horizontal","scrollViewId","style","bounceWrapperStyle","getBounceWrapperStyle","Boolean","enableBounce","bounceableProps","startBounceView","endBounceView","upperExposureView","lowerExposureView","bounceMTSProps","useBounce","nativeBounceMTSProps","useNativeBounce","activeBounceMTSProps","view","scroll-view","__LEPUS__"],"mappings":";;;;AAuBA,SAASA,0BACPC,KAQC,EACDC,IAAiC;IAEjC,MAAM,EACJC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,YAAY,EACZC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjBC,gBAAgB,KAAK,EACtB,GAAGR;IAGJ,MAAMS,aAAaJ,YAAY,CAAC,WAAW,IAEtCA,AAA6B,UAA7BA,YAAY,CAAC,WAAW;IAC7B,MAAMK,eAAeL,aAAa,EAAE;IACpC,MAAM,EAAEM,KAAK,EAAE,GAAGN;IAClB,MAAMO,qBAAqBC,sBAAsBF,OAAOG,QAAQL;IAEhE,IAAIM,eAAe;IACnB,IAAIC,kBAAwC;QAAE,eAAe;IAAM;IACnE,IAAIC,iBAAiBC,eAAeC,mBAAmBC;IACvD,IAAI,AAA6B,aAA7B,OAAOjB,mBAAiC;QAC1CY,eAAeZ;QACfa,kBAAkB;YAChB,eAAe;YACf,mBAAmB;YACnB,gBAAgB;YAChB,u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ACtEjB,aAAa,SAAS,OACvB,SAAS,EAAEA,aAAa,SAAS,OAAO,CAAC,CAAC,EAC3C,gBAAgBC,cAChB,YAAY,oBACZ,IAAI,GAAGA,aAAa,kBAAkB,CAAC,EACvC,YAAY,iBAAiBW,eAAe,kBAAkB,EAC9D,YAAY,cAAcA,eAAe,eAAe,EACxD,YAAY,SAAShB,YAAY,CAAC,sBAAsB;QAG5De,oBAAoB,CAACZ,kBAClBkB,KACC,OAAO,CAAC,gEAAgE,EACtEjB,aAAa,SAAS,OACvB,SAAS,EAAEA,aAAa,SAAS,OAAO,CAAC,CAAC,EAC3C,gBAAgBC,cAChB,YAAY,oBACZ,IAAI,GAAGA,aAAa,kBAAkB,CAAC,EACvC,YAAY,iBAAiBW,eAAe,kBAAkB,EAC9D,YAAY,cAAcA,eAAe,eAAe,EACxD,YAAY,SAAShB,YAAY,CAAC,sBAAsB;IAG9D;IAEA,QACGqB,KACC,IAAI,GAAGhB,aAAa,cAAc,CAAC,EACnC,SAAS,OACT,OAAOE,oBACP,YAAY,SAASP,YAAY,CAAC,sBAAsB,EACzD;MACC,CAACsB,aACE,GAAGtB,YAAY,GACf,GAAGoB,oBAAoB,EACxB,SAASjB,eACT,+BAA+B,MAG/B,MAAMoB,YAAY,UAAU,cAC7B;QACC,CAACT,kBAAkB;QACnB,CAACf,OAAO;QACR,CAACF,SAAS;QACV,CAACkB,kBAAkB;MACrB,EAAEO,YAAY;MACd,CAACV,gBAAgB;MACjB,CAACC,cAAc;IACjB,EAAEQ;AAEN;AAEA,sCAAe3B"}
@@ -0,0 +1,3 @@
1
+ import type { CSSProperties } from '@lynx-js/types';
2
+ export declare function getBounceWrapperStyle(style: CSSProperties | undefined, horizontal: boolean): CSSProperties;
3
+ //# sourceMappingURL=bounceWrapperUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounceWrapperUtils.d.ts","sourceRoot":"","sources":["../src/bounceWrapperUtils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,UAAU,EAAE,OAAO,GAClB,aAAa,CAiBf"}
@@ -0,0 +1,21 @@
1
+ function getBounceWrapperStyle(style, horizontal) {
2
+ return {
3
+ display: 'flex',
4
+ flexDirection: 'column',
5
+ overflow: 'hidden',
6
+ height: horizontal ? '100%' : style?.height,
7
+ width: horizontal ? style?.width : '100%',
8
+ borderRadius: style?.borderRadius,
9
+ borderTopLeftRadius: style?.borderTopLeftRadius,
10
+ borderTopRightRadius: style?.borderTopRightRadius,
11
+ borderBottomLeftRadius: style?.borderBottomLeftRadius,
12
+ borderBottomRightRadius: style?.borderBottomRightRadius,
13
+ borderStartStartRadius: style?.borderStartStartRadius,
14
+ borderStartEndRadius: style?.borderStartEndRadius,
15
+ borderEndStartRadius: style?.borderEndStartRadius,
16
+ borderEndEndRadius: style?.borderEndEndRadius
17
+ };
18
+ }
19
+ export { getBounceWrapperStyle };
20
+
21
+ //# sourceMappingURL=bounceWrapperUtils.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounceWrapperUtils.jsx","sources":["../src/bounceWrapperUtils.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 { CSSProperties } from '@lynx-js/types'\n\nexport function getBounceWrapperStyle(\n style: CSSProperties | undefined,\n horizontal: boolean,\n): CSSProperties {\n return {\n display: 'flex',\n flexDirection: 'column',\n overflow: 'hidden',\n height: horizontal ? '100%' : style?.height,\n width: horizontal ? style?.width : '100%',\n borderRadius: style?.borderRadius,\n borderTopLeftRadius: style?.borderTopLeftRadius,\n borderTopRightRadius: style?.borderTopRightRadius,\n borderBottomLeftRadius: style?.borderBottomLeftRadius,\n borderBottomRightRadius: style?.borderBottomRightRadius,\n borderStartStartRadius: style?.borderStartStartRadius,\n borderStartEndRadius: style?.borderStartEndRadius,\n borderEndStartRadius: style?.borderEndStartRadius,\n borderEndEndRadius: style?.borderEndEndRadius,\n }\n}\n"],"names":["getBounceWrapperStyle","style","horizontal"],"mappings":"AAMO,SAASA,sBACdC,KAAgC,EAChCC,UAAmB;IAEnB,OAAO;QACL,SAAS;QACT,eAAe;QACf,UAAU;QACV,QAAQA,aAAa,SAASD,OAAO;QACrC,OAAOC,aAAaD,OAAO,QAAQ;QACnC,cAAcA,OAAO;QACrB,qBAAqBA,OAAO;QAC5B,sBAAsBA,OAAO;QAC7B,wBAAwBA,OAAO;QAC/B,yBAAyBA,OAAO;QAChC,wBAAwBA,OAAO;QAC/B,sBAAsBA,OAAO;QAC7B,sBAAsBA,OAAO;QAC7B,oBAAoBA,OAAO;IAC7B;AACF"}
@@ -0,0 +1,7 @@
1
+ export declare function nativeBounceUtilsDummyBTS(): void;
2
+ export declare function getNativeBounceMetricsMT(offset: number, scrollSize: number, viewportSize: number, enableUpper: boolean, enableLower: boolean): {
3
+ maxScrollOffset: number;
4
+ upperDistance: number;
5
+ lowerDistance: number;
6
+ };
7
+ //# sourceMappingURL=nativeBounceUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeBounceUtils.d.ts","sourceRoot":"","sources":["../../src/hooks/nativeBounceUtils.ts"],"names":[],"mappings":"AAMA,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO;;;;EAYrB"}
@@ -0,0 +1,13 @@
1
+ function nativeBounceUtilsDummyBTS() {}
2
+ function getNativeBounceMetricsMT(offset, scrollSize, viewportSize, enableUpper, enableLower) {
3
+ 'main thread';
4
+ const maxScrollOffset = Math.max(0, scrollSize - viewportSize);
5
+ return {
6
+ maxScrollOffset,
7
+ upperDistance: enableUpper ? Math.max(0, -offset) : 0,
8
+ lowerDistance: enableLower ? Math.max(0, offset - maxScrollOffset) : 0
9
+ };
10
+ }
11
+ export { getNativeBounceMetricsMT, nativeBounceUtilsDummyBTS };
12
+
13
+ //# sourceMappingURL=nativeBounceUtils.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/nativeBounceUtils.jsx","sources":["../../src/hooks/nativeBounceUtils.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\n// Older ReactLynx versions incorrectly tree-shake files that only contain\n// main thread functions, so this file must also contain a BTS function.\nexport function nativeBounceUtilsDummyBTS(): void {\n // Intentionally empty\n}\n\nexport function getNativeBounceMetricsMT(\n offset: number,\n scrollSize: number,\n viewportSize: number,\n enableUpper: boolean,\n enableLower: boolean,\n) {\n 'main thread'\n const maxScrollOffset = Math.max(0, scrollSize - viewportSize)\n\n return {\n maxScrollOffset,\n upperDistance: enableUpper ? Math.max(0, -offset) : 0,\n lowerDistance: enableLower\n ? Math.max(0, offset - maxScrollOffset)\n : 0,\n }\n}\n"],"names":["nativeBounceUtilsDummyBTS","getNativeBounceMetricsMT","offset","scrollSize","viewportSize","enableUpper","enableLower","maxScrollOffset","Math"],"mappings":"AAMO,SAASA,6BAEhB;AAEO,SAASC,yBACdC,MAAc,EACdC,UAAkB,EAClBC,YAAoB,EACpBC,WAAoB,EACpBC,WAAoB;IAEpB;IACA,MAAMC,kBAAkBC,KAAK,GAAG,CAAC,GAAGL,aAAaC;IAEjD,OAAO;QACLG;QACA,eAAeF,cAAcG,KAAK,GAAG,CAAC,GAAG,CAACN,UAAU;QACpD,eAAeI,cACXE,KAAK,GAAG,CAAC,GAAGN,SAASK,mBACrB;IACN;AACF"}
@@ -0,0 +1,17 @@
1
+ import type { CommonEvent, ScrollEvent } from '@lynx-js/types';
2
+ import type { BounceableBasicProps } from '../types/index.js';
3
+ interface UseNativeBounceOptions {
4
+ bounceableOptions: BounceableBasicProps;
5
+ debugLog?: boolean;
6
+ enableRTL?: boolean;
7
+ id?: string;
8
+ scrollOrientation: 'vertical' | 'horizontal';
9
+ }
10
+ interface NativeBounceHandlers {
11
+ 'main-thread:bindlayoutchange': (event: CommonEvent) => void;
12
+ 'main-thread:bindscroll': (event: ScrollEvent) => void;
13
+ 'main-thread:bindscrollend': (event: ScrollEvent) => void;
14
+ }
15
+ export declare function useNativeBounce(options: UseNativeBounceOptions): NativeBounceHandlers;
16
+ export {};
17
+ //# sourceMappingURL=useNativeBounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNativeBounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useNativeBounce.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE9D,OAAO,KAAK,EAAE,oBAAoB,EAAuB,MAAM,UAAU,CAAA;AAGzE,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,iBAAiB,EAAE,UAAU,GAAG,YAAY,CAAA;CAC7C;AAED,UAAU,oBAAoB;IAC5B,8BAA8B,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC5D,wBAAwB,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACtD,2BAA2B,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;CAC1D;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,oBAAoB,CAmKtB"}
@@ -0,0 +1,80 @@
1
+ import { runOnBackground, useMainThreadRef } from "@lynx-js/react";
2
+ import { mtsLog, selectorMT } from "@lynx-js/lynx-ui-common";
3
+ import { getNativeBounceMetricsMT } from "./nativeBounceUtils.jsx";
4
+ function useNativeBounce(options) {
5
+ const containerID = options.id ?? 'bounceableContainer';
6
+ const isVertical = 'vertical' === options.scrollOrientation;
7
+ const enableRTL = options.enableRTL ?? false;
8
+ const debugLogEnabled = Boolean(options.debugLog);
9
+ const height = useMainThreadRef(options.bounceableOptions.estimatedHeight ?? 0);
10
+ const width = useMainThreadRef(options.bounceableOptions.estimatedWidth ?? 0);
11
+ const maxUpperDistance = useMainThreadRef(0);
12
+ const maxLowerDistance = useMainThreadRef(0);
13
+ const lastBounceDirection = useMainThreadRef(null);
14
+ const singleSidedBounce = options.bounceableOptions.singleSidedBounce ?? 'both';
15
+ const enableUpper = 'upper' === singleSidedBounce || 'both' === singleSidedBounce || 'iOSBounces' === singleSidedBounce;
16
+ const enableLower = 'lower' === singleSidedBounce || 'both' === singleSidedBounce || 'iOSBounces' === singleSidedBounce;
17
+ function setBounceViewOffset(upperDistance, lowerDistance) {
18
+ 'main thread';
19
+ if (isVertical) {
20
+ selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty('transform', `translateY(${upperDistance}px)`);
21
+ selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty('transform', `translateY(${-lowerDistance}px)`);
22
+ } else {
23
+ const direction = enableRTL ? -1 : 1;
24
+ selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty('transform', `translateX(${direction * upperDistance}px)`);
25
+ selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty('transform', `translateX(${-direction * lowerDistance}px)`);
26
+ }
27
+ }
28
+ function onScrollToBouncesJS(info) {
29
+ options.bounceableOptions.onScrollToBounces?.(info);
30
+ }
31
+ function nativeBounceLayoutChange(event) {
32
+ 'main thread';
33
+ const isAndroid = 'Android' === SystemInfo.platform;
34
+ height.current = (isAndroid ? event.params?.height : event.detail?.height) ?? 0;
35
+ width.current = (isAndroid ? event.params?.width : event.detail?.width) ?? 0;
36
+ mtsLog(debugLogEnabled, `[lynx-ui-scroll-view][useNativeBounce] layout change, height: ${height.current}, width: ${width.current}`);
37
+ }
38
+ function nativeBounceScroll(event) {
39
+ 'main thread';
40
+ const offset = isVertical ? event.detail.scrollTop : event.detail.scrollLeft;
41
+ const scrollSize = isVertical ? event.detail.scrollHeight : event.detail.scrollWidth;
42
+ const viewportSize = isVertical ? height.current : width.current;
43
+ const { maxScrollOffset, upperDistance, lowerDistance } = getNativeBounceMetricsMT(offset, scrollSize, viewportSize, enableUpper, enableLower);
44
+ mtsLog(debugLogEnabled, `[lynx-ui-scroll-view][useNativeBounce] scroll, offset: ${offset}, scrollSize: ${scrollSize}, viewportSize: ${viewportSize}, maxScrollOffset: ${maxScrollOffset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}`);
45
+ setBounceViewOffset(upperDistance, lowerDistance);
46
+ if (upperDistance > 0) {
47
+ maxUpperDistance.current = Math.max(maxUpperDistance.current, upperDistance);
48
+ lastBounceDirection.current = 'upper';
49
+ } else if (lowerDistance > 0) {
50
+ maxLowerDistance.current = Math.max(maxLowerDistance.current, lowerDistance);
51
+ lastBounceDirection.current = 'lower';
52
+ }
53
+ }
54
+ function nativeBounceScrollEnd(event) {
55
+ 'main thread';
56
+ const offset = isVertical ? event.detail.scrollTop : event.detail.scrollLeft;
57
+ const scrollSize = isVertical ? event.detail.scrollHeight : event.detail.scrollWidth;
58
+ const viewportSize = isVertical ? height.current : width.current;
59
+ const { upperDistance, lowerDistance } = getNativeBounceMetricsMT(offset, scrollSize, viewportSize, enableUpper, enableLower);
60
+ setBounceViewOffset(upperDistance, lowerDistance);
61
+ const direction = lastBounceDirection.current;
62
+ const triggerDistance = 'upper' === direction ? options.bounceableOptions.startBounceTriggerDistance ?? 0 : options.bounceableOptions.endBounceTriggerDistance ?? 0;
63
+ const maxDistance = 'upper' === direction ? maxUpperDistance.current : maxLowerDistance.current;
64
+ mtsLog(debugLogEnabled, `[lynx-ui-scroll-view][useNativeBounce] scroll end, offset: ${offset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}, direction: ${String(direction)}, maxUpperDistance: ${maxUpperDistance.current}, maxLowerDistance: ${maxLowerDistance.current}, triggerDistance: ${triggerDistance}`);
65
+ if (null !== direction && maxDistance > triggerDistance) runOnBackground(onScrollToBouncesJS)({
66
+ direction
67
+ });
68
+ maxUpperDistance.current = 0;
69
+ maxLowerDistance.current = 0;
70
+ lastBounceDirection.current = null;
71
+ }
72
+ return {
73
+ 'main-thread:bindlayoutchange': nativeBounceLayoutChange,
74
+ 'main-thread:bindscroll': nativeBounceScroll,
75
+ 'main-thread:bindscrollend': nativeBounceScrollEnd
76
+ };
77
+ }
78
+ export { useNativeBounce };
79
+
80
+ //# sourceMappingURL=useNativeBounce.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks/useNativeBounce.jsx","sources":["../../src/hooks/useNativeBounce.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 { mtsLog, selectorMT } from '@lynx-js/lynx-ui-common'\nimport type { CommonEvent, ScrollEvent } from '@lynx-js/types'\n\nimport type { BounceableBasicProps, scrollToBouncesInfo } from '../types'\nimport { getNativeBounceMetricsMT } from './nativeBounceUtils'\n\ninterface UseNativeBounceOptions {\n bounceableOptions: BounceableBasicProps\n debugLog?: boolean\n enableRTL?: boolean\n id?: string\n scrollOrientation: 'vertical' | 'horizontal'\n}\n\ninterface NativeBounceHandlers {\n 'main-thread:bindlayoutchange': (event: CommonEvent) => void\n 'main-thread:bindscroll': (event: ScrollEvent) => void\n 'main-thread:bindscrollend': (event: ScrollEvent) => void\n}\n\nexport function useNativeBounce(\n options: UseNativeBounceOptions,\n): NativeBounceHandlers {\n const containerID = options.id ?? 'bounceableContainer'\n const isVertical = options.scrollOrientation === 'vertical'\n const enableRTL = options.enableRTL ?? false\n const debugLogEnabled = Boolean(options.debugLog)\n const height = useMainThreadRef(\n options.bounceableOptions.estimatedHeight ?? 0,\n )\n const width = useMainThreadRef(\n options.bounceableOptions.estimatedWidth ?? 0,\n )\n const maxUpperDistance = useMainThreadRef(0)\n const maxLowerDistance = useMainThreadRef(0)\n const lastBounceDirection = useMainThreadRef<'upper' | 'lower' | null>(null)\n\n const singleSidedBounce = options.bounceableOptions.singleSidedBounce\n ?? 'both'\n const enableUpper = singleSidedBounce === 'upper'\n || singleSidedBounce === 'both'\n || singleSidedBounce === 'iOSBounces'\n const enableLower = singleSidedBounce === 'lower'\n || singleSidedBounce === 'both'\n || singleSidedBounce === 'iOSBounces'\n\n function setBounceViewOffset(upperDistance: number, lowerDistance: number) {\n 'main thread'\n if (isVertical) {\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${upperDistance}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateY(${-lowerDistance}px)`,\n )\n } else {\n const direction = enableRTL ? -1 : 1\n selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${direction * upperDistance}px)`,\n )\n selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(\n 'transform',\n `translateX(${-direction * lowerDistance}px)`,\n )\n }\n }\n\n function onScrollToBouncesJS(info: scrollToBouncesInfo) {\n options.bounceableOptions.onScrollToBounces?.(info)\n }\n\n function nativeBounceLayoutChange(event: CommonEvent) {\n 'main thread'\n const isAndroid = SystemInfo.platform === 'Android'\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) ?? 0\n\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useNativeBounce] layout change, height: ${height.current}, width: ${width.current}`,\n )\n }\n\n function nativeBounceScroll(event: ScrollEvent) {\n 'main thread'\n const offset = isVertical\n ? event.detail.scrollTop\n : event.detail.scrollLeft\n const scrollSize = isVertical\n ? event.detail.scrollHeight\n : event.detail.scrollWidth\n const viewportSize = isVertical ? height.current : width.current\n const {\n maxScrollOffset,\n upperDistance,\n lowerDistance,\n } = getNativeBounceMetricsMT(\n offset,\n scrollSize,\n viewportSize,\n enableUpper,\n enableLower,\n )\n\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useNativeBounce] scroll, offset: ${offset}, scrollSize: ${scrollSize}, viewportSize: ${viewportSize}, maxScrollOffset: ${maxScrollOffset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}`,\n )\n\n setBounceViewOffset(upperDistance, lowerDistance)\n\n if (upperDistance > 0) {\n maxUpperDistance.current = Math.max(\n maxUpperDistance.current,\n upperDistance,\n )\n lastBounceDirection.current = 'upper'\n } else if (lowerDistance > 0) {\n maxLowerDistance.current = Math.max(\n maxLowerDistance.current,\n lowerDistance,\n )\n lastBounceDirection.current = 'lower'\n }\n }\n\n function nativeBounceScrollEnd(event: ScrollEvent) {\n 'main thread'\n const offset = isVertical\n ? event.detail.scrollTop\n : event.detail.scrollLeft\n const scrollSize = isVertical\n ? event.detail.scrollHeight\n : event.detail.scrollWidth\n const viewportSize = isVertical ? height.current : width.current\n const { upperDistance, lowerDistance } = getNativeBounceMetricsMT(\n offset,\n scrollSize,\n viewportSize,\n enableUpper,\n enableLower,\n )\n\n setBounceViewOffset(upperDistance, lowerDistance)\n\n const direction = lastBounceDirection.current\n const triggerDistance = direction === 'upper'\n ? (options.bounceableOptions.startBounceTriggerDistance ?? 0)\n : (options.bounceableOptions.endBounceTriggerDistance ?? 0)\n const maxDistance = direction === 'upper'\n ? maxUpperDistance.current\n : maxLowerDistance.current\n\n mtsLog(\n debugLogEnabled,\n `[lynx-ui-scroll-view][useNativeBounce] scroll end, offset: ${offset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}, direction: ${\n String(direction)\n }, maxUpperDistance: ${maxUpperDistance.current}, maxLowerDistance: ${maxLowerDistance.current}, triggerDistance: ${triggerDistance}`,\n )\n\n if (\n direction !== null\n && maxDistance > triggerDistance\n ) {\n runOnBackground(onScrollToBouncesJS)({ direction })\n }\n\n maxUpperDistance.current = 0\n maxLowerDistance.current = 0\n lastBounceDirection.current = null\n }\n\n return {\n 'main-thread:bindlayoutchange': nativeBounceLayoutChange,\n 'main-thread:bindscroll': nativeBounceScroll,\n 'main-thread:bindscrollend': nativeBounceScrollEnd,\n }\n}\n"],"names":["useNativeBounce","options","containerID","isVertical","enableRTL","debugLogEnabled","Boolean","height","useMainThreadRef","width","maxUpperDistance","maxLowerDistance","lastBounceDirection","singleSidedBounce","enableUpper","enableLower","setBounceViewOffset","upperDistance","lowerDistance","selectorMT","direction","onScrollToBouncesJS","info","nativeBounceLayoutChange","event","isAndroid","SystemInfo","mtsLog","nativeBounceScroll","offset","scrollSize","viewportSize","maxScrollOffset","getNativeBounceMetricsMT","Math","nativeBounceScrollEnd","triggerDistance","maxDistance","String","runOnBackground"],"mappings":";;;AA0BO,SAASA,gBACdC,OAA+B;IAE/B,MAAMC,cAAcD,QAAQ,EAAE,IAAI;IAClC,MAAME,aAAaF,AAA8B,eAA9BA,QAAQ,iBAAiB;IAC5C,MAAMG,YAAYH,QAAQ,SAAS,IAAI;IACvC,MAAMI,kBAAkBC,QAAQL,QAAQ,QAAQ;IAChD,MAAMM,SAASC,iBACbP,QAAQ,iBAAiB,CAAC,eAAe,IAAI;IAE/C,MAAMQ,QAAQD,iBACZP,QAAQ,iBAAiB,CAAC,cAAc,IAAI;IAE9C,MAAMS,mBAAmBF,iBAAiB;IAC1C,MAAMG,mBAAmBH,iBAAiB;IAC1C,MAAMI,sBAAsBJ,iBAA2C;IAEvE,MAAMK,oBAAoBZ,QAAQ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BAAkBhB,AAAc,YAAdA,YACnBnB,QAAQ,iBAAiB,CAAC,0BAA0B,IAAI,IACxDA,QAAQ,iBAAiB,CAAC,wBAAwB,IAAI;QAC3D,MAAMoC,cAAcjB,AAAc,YAAdA,YAChBV,iBAAiB,OAAO,GACxBC,iBAAiB,OAAO;QAE5BgB,OACEtB,iBACA,CAAC,2DAA2D,EAAEwB,OAAO,iBAAiB,EAAEZ,cAAc,iBAAiB,EAAEC,cAAc,aAAa,EAClJoB,OAAOlB,WACR,oBAAoB,EAAEV,iBAAiB,OAAO,CAAC,oBAAoB,EAAEC,iBAAiB,OAAO,CAAC,mBAAmB,EAAEyB,iBAAiB;QAGvI,IACEhB,AAAc,SAAdA,aACGiB,cAAcD,iBAEjBG,gBAAgBlB,qBAAqB;YAAED;QAAU;QAGnDV,iBAAiB,OAAO,GAAG;QAC3BC,iBAAiB,OAAO,GAAG;QAC3BC,oBAAoB,OAAO,GAAG;IAChC;IAEA,OAAO;QACL,gCAAgCW;QAChC,0BAA0BK;QAC1B,6BAA6BO;IAC/B;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import '@lynx-js/gesture-runtime';
2
- import type { ScrollViewProps, ScrollViewRef, ScrollView as ScrollViewType } from './types';
2
+ import type { ScrollViewProps, ScrollViewRef, ScrollView as ScrollViewType } from './types/index.js';
3
3
  export type { ScrollViewProps, ScrollViewRef };
4
- export { useBounce } from './hooks/useBounce';
5
- export type { bounceHandlers } from './hooks/useBounce';
6
- export type { BounceableBasicProps } from './types';
4
+ export { useBounce } from './hooks/useBounce.js';
5
+ export type { bounceHandlers } from './hooks/useBounce.js';
6
+ export type { BounceableBasicProps } from './types/index.js';
7
7
  export declare const ScrollView: ScrollViewType;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,0BAA0B,CAAA;AAkBjC,OAAO,KAAK,EAEV,eAAe,EACf,aAAa,EACb,UAAU,IAAI,cAAc,EAC7B,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,UAAU,EAAuC,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,0BAA0B,CAAA;AAmBjC,OAAO,KAAK,EAEV,eAAe,EACf,aAAa,EACb,UAAU,IAAI,cAAc,EAC7B,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,UAAU,EAAuC,cAAc,CAAA"}
package/dist/index.jsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, memo, useRef } from "@lynx-js/react";
2
2
  import "@lynx-js/gesture-runtime";
3
- import { ExposureEventsMapping, LayoutEventsMapping, ScrollEventsMapping, TouchEventsMapping, useRegisteredEvents } from "@lynx-js/lynx-ui-common";
3
+ import { ExposureEventsMapping, LayoutEventsMapping, ScrollEventsMapping, TouchEventsMapping, nativeLynxSDKVersionLessThan, useRegisteredEvents } from "@lynx-js/lynx-ui-common";
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";
@@ -13,7 +13,8 @@ function ScrollViewImpl(props, _ref) {
13
13
  const { scrollviewId = 'scrollview', horizontal = false, style, children, scrollOrientation, lazyOptions, className = '', debugLog = false, enableRTL = false, bounceableOptions = {
14
14
  enableBounces: true,
15
15
  singleSidedBounce: 'iOSBounces'
16
- }, enableScroll = true, enableScrollMonitor = false, scrollMonitorTag, sticky, scrollPropagationBehavior = 'native', temporaryBlockScrollClass = 'BDXLynxViewPager', temporaryBlockScrollTag = 0, temporaryNestedScroll, experimentalNestedScrollForward, experimentalNestedScrollBackward, androidTouchSlop, 'main-thread:gesture': gesture } = props;
16
+ }, enableScroll = true, enableScrollMonitor = false, enableNewArch: enableNewArchProp, scrollMonitorTag, sticky, scrollPropagationBehavior = 'native', temporaryBlockScrollClass = 'BDXLynxViewPager', temporaryBlockScrollTag = 0, temporaryNestedScroll, experimentalNestedScrollForward, experimentalNestedScrollBackward, androidTouchSlop, 'main-thread:gesture': gesture } = props;
17
+ const enableNewArch = enableNewArchProp ?? !nativeLynxSDKVersionLessThan('4.3');
17
18
  const scrollViewRegisteredEvents = useRef({
18
19
  ...ScrollEventsMapping,
19
20
  ...ExposureEventsMapping,
@@ -50,7 +51,7 @@ function ScrollViewImpl(props, _ref) {
50
51
  bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true;
51
52
  bounceableProps.validAnimationVersion = bounceableOptions.validAnimationVersion ?? true;
52
53
  }
53
- const platformBounces = enableBounce && bounceableProps?.singleSidedBounce === 'iOSBounces';
54
+ const nativeBounces = enableBounce && (enableNewArch ? 'none' !== bounceableProps.singleSidedBounce : 'iOSBounces' === bounceableProps.singleSidedBounce);
54
55
  const shouldEnableNested = ()=>{
55
56
  if ('iOS' === SystemInfo.platform && 'propagate' !== scrollPropagationBehavior) return false;
56
57
  return true;
@@ -69,6 +70,10 @@ function ScrollViewImpl(props, _ref) {
69
70
  id: scrollviewId,
70
71
  'scroll-x': isHorizontal(),
71
72
  'scroll-y': !isHorizontal(),
73
+ ...enableNewArch && {
74
+ 'scroll-orientation': isHorizontal() ? 'horizontal' : 'vertical',
75
+ 'scroll-view-new-arch': true
76
+ },
72
77
  'enable-scroll-monitor': enableScrollMonitor,
73
78
  'scroll-monitor-tag': scrollMonitorTag,
74
79
  'main-thread:gesture': gesture,
@@ -79,7 +84,7 @@ function ScrollViewImpl(props, _ref) {
79
84
  'enable-new-nested': true,
80
85
  className: className,
81
86
  style: normalizedStyle,
82
- bounces: platformBounces,
87
+ bounces: nativeBounces,
83
88
  'enable-scroll': enableScroll,
84
89
  ...void 0 !== androidTouchSlop && {
85
90
  'android-touch-slop': androidTouchSlop
@@ -92,6 +97,14 @@ function ScrollViewImpl(props, _ref) {
92
97
  },
93
98
  ...registerEvents
94
99
  };
100
+ if (enableNewArch) {
101
+ if (nativeBounces && (bounceableProps.upperBounceItem || bounceableProps.lowerBounceItem || bounceableProps.onScrollToBounces)) return <ScrollViewWithBouncesHook elementProps={elementProps} bounceableOptions={bounceableProps} debugLog={debugLog} enableRTL={enableRTL} nativeBounces={true} sticky={sticky}>
102
+ {renderChildren(children, normalizedLazyOptions)}
103
+ </ScrollViewWithBouncesHook>;
104
+ return <ScrollViewBasic elementProps={elementProps} sticky={sticky}>
105
+ {renderChildren(children, normalizedLazyOptions)}
106
+ </ScrollViewBasic>;
107
+ }
95
108
  if (enableBounce && 'iOSBounces' !== bounceableProps.singleSidedBounce && 'none' !== bounceableProps.singleSidedBounce) return <ScrollViewWithBouncesHook elementProps={elementProps} bounceableOptions={bounceableProps} debugLog={debugLog} enableRTL={enableRTL} sticky={sticky}>
96
109
  {renderChildren(children, normalizedLazyOptions)}
97
110
  </ScrollViewWithBouncesHook>;
@@ -1 +1 @@
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,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iBAAiB1B;QACjB,GAAIU,AAAqBS,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 nativeLynxSDKVersionLessThan,\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 enableNewArch: enableNewArchProp,\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 const enableNewArch = enableNewArchProp\n ?? !nativeLynxSDKVersionLessThan('4.3')\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 // The new architecture provides native bounces on every platform. On the\n // legacy architecture, native bounces are only used for iOSBounces.\n const nativeBounces = enableBounce\n && (enableNewArch\n ? bounceableProps.singleSidedBounce !== 'none'\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 'scroll-orientation'?: 'horizontal' | 'vertical'\n 'scroll-view-new-arch'?: 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 ...(enableNewArch && {\n 'scroll-orientation': isHorizontal() ? 'horizontal' : 'vertical',\n 'scroll-view-new-arch': true,\n }),\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': nativeBounces,\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 (enableNewArch) {\n if (\n nativeBounces\n && (bounceableProps.upperBounceItem\n || bounceableProps.lowerBounceItem\n || bounceableProps.onScrollToBounces)\n ) {\n return (\n <ScrollViewWithBouncesHook\n elementProps={elementProps}\n bounceableOptions={bounceableProps}\n debugLog={debugLog}\n enableRTL={enableRTL}\n nativeBounces={true}\n sticky={sticky}\n >\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewWithBouncesHook>\n )\n }\n return (\n <ScrollViewBasic elementProps={elementProps} sticky={sticky}>\n {renderChildren(children, normalizedLazyOptions)}\n </ScrollViewBasic>\n )\n } else 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","enableNewArchProp","scrollMonitorTag","sticky","scrollPropagationBehavior","temporaryBlockScrollClass","temporaryBlockScrollTag","temporaryNestedScroll","experimentalNestedScrollForward","experimentalNestedScrollBackward","androidTouchSlop","gesture","enableNewArch","nativeLynxSDKVersionLessThan","scrollViewRegisteredEvents","useRef","ScrollEventsMapping","ExposureEventsMapping","TouchEventsMapping","LayoutEventsMapping","normalizedLazyOptions","undefined","registerEvents","useRegisteredEvents","normalizedStyle","isHorizontal","enableBounce","bounceableProps","nativeBounces","shouldEnableNested","SystemInfo","renderChildren","Array","lazy","item","index","Number","LazyComponent","elementProps","ScrollViewWithBouncesHook","ScrollViewBasic"],"mappings":";;;;;;AAsCO,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,EAC3B,eAAeC,iBAAiB,EAChCC,gBAAgB,EAChBC,MAAM,EACNC,4BAA4B,QAAQ,EACpCC,4BAA4B,kBAAkB,EAC9CC,0BAA0B,CAAC,EAC3BC,qBAAqB,EACrBC,+BAA+B,EAC/BC,gCAAgC,EAChCC,gBAAgB,EAChB,uBAAuBC,OAAO,EAC/B,GAAGxB;IACJ,MAAMyB,gBAAgBX,qBACjB,CAACY,6BAA6B;IAEnC,MAAMC,6BAA6BC,OAA+B;QAChE,GAAGC,mBAAmB;QACtB,GAAGC,qBAAqB;QACxB,GAAGC,kBAAkB;QACrB,GAAGC,mBAAmB;QACtB,GAAGjC,sBAAsB;IAC3B;IACA,MAAMkC,wBAAiD1B,cACnD;QAAE,sBAAsB;QAAG,GAAGA,WAAW;IAAC,IAC1C2B;IACJ,MAAMC,iBAAiBC,oBACrBpC,OACA2B,2BAA2B,OAAO;IAEpC,MAAMU,kBAAiC;QACrC,QAAQ;QACR,GAAGjC,KAAK;IACV;IAEA,MAAMkC,eAAe,I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QACC,CAAC4B,eAAevC,UAAU4B,uBAAuB;MACnD,EAAEmB;IAGJ,QACGC,gBAAgB,cAAcF,cAAc,QAAQnC,QAAQ;QAC3D,CAAC4B,eAAevC,UAAU4B,uBAAuB;MACnD,EAAEoB;AAGR"}
@@ -1,2 +1,2 @@
1
- export type * from './index.docs';
1
+ export type * from './index.docs.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -149,6 +149,15 @@ export interface ScrollViewProps extends BaseUITouchEvents, BaseScrollEvents, Ba
149
149
  * @Harmony
150
150
  */
151
151
  enableScrollMonitor?: boolean;
152
+ /**
153
+ * Enable the native `<scroll-view>` new architecture. When enabled, `bounceableOptions` uses native bounces on Android, iOS, and Harmony. Defaults to `true` on Lynx SDK 4.3 and newer, and `false` on earlier versions.
154
+ * @zh 启用原生 `<scroll-view>` 新架构。启用后,`bounceableOptions` 会在 Android、iOS 和 Harmony 上使用原生回弹。Lynx SDK 4.3 及以上版本默认为 `true`,更早版本默认为 `false`。
155
+ * @defaultValue `true on Lynx SDK >= 4.3; false otherwise`
156
+ * @Android
157
+ * @iOS
158
+ * @Harmony
159
+ */
160
+ enableNewArch?: boolean;
152
161
  /**
153
162
  * The tag for scroll monitor.
154
163
  * @zh 滚动监控的标签。
@@ -1 +1 @@
1
- {"version":3,"file":"index.docs.d.ts","sourceRoot":"","sources":["../../src/types/index.docs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEhE,MAAM,MAAM,UAAU,GAA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,aAAa,EAAE,OAAO,CAAA;IACtB;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC;;;;;;OAMG;IAEH,eAAe,CAAC,EAAE,GAAG,CAAA;IACrB;;;;;;OAMG;IAEH,eAAe,CAAC,EAAE,GAAG,CAAA;IACrB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAA;IACtE;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAA;CACrD;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAErD,CAAA"}
@@ -1 +1 @@
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"}
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 * Enable the native `<scroll-view>` new architecture. When enabled, `bounceableOptions` uses native bounces on Android, iOS, and Harmony. Defaults to `true` on Lynx SDK 4.3 and newer, and `false` on earlier versions.\n * @zh 启用原生 `<scroll-view>` 新架构。启用后,`bounceableOptions` 会在 Android、iOS 和 Harmony 上使用原生回弹。Lynx SDK 4.3 及以上版本默认为 `true`,更早版本默认为 `false`。\n * @defaultValue `true on Lynx SDK >= 4.3; false otherwise`\n * @Android\n * @iOS\n * @Harmony\n */\n enableNewArch?: 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":"AA0bO,MAAMA,qBAA6C;IACxD,qBAAqB;AACvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/lynx-ui-scroll-view",
3
- "version": "3.136.0",
3
+ "version": "3.137.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-family/lynx-ui.git",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@lynx-js/gesture-runtime": "2.1.1",
29
- "@lynx-js/lynx-ui-common": "3.136.0",
30
- "@lynx-js/lynx-ui-lazy-component": "3.136.0"
29
+ "@lynx-js/lynx-ui-common": "3.137.0",
30
+ "@lynx-js/lynx-ui-lazy-component": "3.137.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@lynx-js/react": "0.123.1",
@@ -10,7 +10,9 @@ import type {
10
10
  ScrollViewProps as ScrollViewElementProps,
11
11
  } from '@lynx-js/types'
12
12
 
13
+ import { getBounceWrapperStyle } from './bounceWrapperUtils'
13
14
  import { useBounce } from './hooks/useBounce'
15
+ import { useNativeBounce } from './hooks/useNativeBounce'
14
16
  import type {
15
17
  BounceableBasicProps,
16
18
  ScrollViewProps,
@@ -26,6 +28,7 @@ function ScrollViewWithBouncesHook(
26
28
  bounceableOptions?: BounceableBasicProps
27
29
  debugLog?: boolean
28
30
  enableRTL?: boolean
31
+ nativeBounces?: boolean
29
32
  sticky?: ReactElement
30
33
  },
31
34
  _ref: ForwardedRef<ScrollViewRef>,
@@ -37,6 +40,7 @@ function ScrollViewWithBouncesHook(
37
40
  elementProps,
38
41
  debugLog = false,
39
42
  enableRTL = false,
43
+ nativeBounces = false,
40
44
  } = props
41
45
  // @ts-expect-error Compatible with older versions
42
46
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -45,6 +49,7 @@ function ScrollViewWithBouncesHook(
45
49
  ?? elementProps['scroll-y'] === false
46
50
  const scrollViewId = elementProps.id
47
51
  const { style } = elementProps as { style: CSSProperties }
52
+ const bounceWrapperStyle = getBounceWrapperStyle(style, Boolean(horizontal))
48
53
  // Initialize bounceableProps
49
54
  let enableBounce = false
50
55
  let bounceableProps: BounceableBasicProps = { enableBounces: false }
@@ -73,6 +78,16 @@ function ScrollViewWithBouncesHook(
73
78
  id: scrollViewId,
74
79
  scrollOrientation: horizontal ? 'horizontal' : 'vertical',
75
80
  })
81
+ const nativeBounceMTSProps = useNativeBounce({
82
+ bounceableOptions: bounceableProps,
83
+ debugLog,
84
+ enableRTL,
85
+ id: scrollViewId,
86
+ scrollOrientation: horizontal ? 'horizontal' : 'vertical',
87
+ })
88
+ const activeBounceMTSProps = nativeBounces
89
+ ? nativeBounceMTSProps
90
+ : bounceMTSProps
76
91
  if (enableBounce) {
77
92
  if (bounceableProps.upperBounceItem) {
78
93
  startBounceView = (
@@ -108,7 +123,7 @@ function ScrollViewWithBouncesHook(
108
123
  </view>
109
124
  )
110
125
  }
111
- upperExposureView = (
126
+ upperExposureView = !nativeBounces && (
112
127
  <view
113
128
  style={`display: flex; flex-direction: column; overflow:hidden; height: ${
114
129
  horizontal ? '100%' : '1ppx'
@@ -121,7 +136,7 @@ function ScrollViewWithBouncesHook(
121
136
  main-thread:gesture={elementProps['main-thread:gesture']}
122
137
  />
123
138
  )
124
- lowerExposureView = (
139
+ lowerExposureView = !nativeBounces && (
125
140
  <view
126
141
  style={`display: flex; flex-direction: column; overflow:hidden; height: ${
127
142
  horizontal ? '100%' : '1ppx'
@@ -139,15 +154,14 @@ function ScrollViewWithBouncesHook(
139
154
  return (
140
155
  <view
141
156
  id={`${scrollViewId}-BounceWrapper`}
142
- style={`display: flex; flex-direction: column; overflow:hidden; height: ${
143
- horizontal ? '100%' : `${style?.height}`
144
- }; width: ${horizontal ? `${style?.width}` : '100%'};`}
157
+ flatten={false}
158
+ style={bounceWrapperStyle}
145
159
  main-thread:gesture={elementProps['main-thread:gesture']}
146
160
  >
147
161
  <scroll-view
148
162
  {...elementProps}
149
- {...bounceMTSProps}
150
- bounces={false}
163
+ {...activeBounceMTSProps}
164
+ bounces={nativeBounces}
151
165
  ios-enable-simultaneous-touch={true}
152
166
  // 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.
153
167
  // We do not use __MAIN_THREAD__ here to maintain compatibility with the old version of @lynx-js/react.
@@ -0,0 +1,27 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import type { CSSProperties } from '@lynx-js/types'
6
+
7
+ export function getBounceWrapperStyle(
8
+ style: CSSProperties | undefined,
9
+ horizontal: boolean,
10
+ ): CSSProperties {
11
+ return {
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ overflow: 'hidden',
15
+ height: horizontal ? '100%' : style?.height,
16
+ width: horizontal ? style?.width : '100%',
17
+ borderRadius: style?.borderRadius,
18
+ borderTopLeftRadius: style?.borderTopLeftRadius,
19
+ borderTopRightRadius: style?.borderTopRightRadius,
20
+ borderBottomLeftRadius: style?.borderBottomLeftRadius,
21
+ borderBottomRightRadius: style?.borderBottomRightRadius,
22
+ borderStartStartRadius: style?.borderStartStartRadius,
23
+ borderStartEndRadius: style?.borderStartEndRadius,
24
+ borderEndStartRadius: style?.borderEndStartRadius,
25
+ borderEndEndRadius: style?.borderEndEndRadius,
26
+ }
27
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ // Older ReactLynx versions incorrectly tree-shake files that only contain
6
+ // main thread functions, so this file must also contain a BTS function.
7
+ export function nativeBounceUtilsDummyBTS(): void {
8
+ // Intentionally empty
9
+ }
10
+
11
+ export function getNativeBounceMetricsMT(
12
+ offset: number,
13
+ scrollSize: number,
14
+ viewportSize: number,
15
+ enableUpper: boolean,
16
+ enableLower: boolean,
17
+ ) {
18
+ 'main thread'
19
+ const maxScrollOffset = Math.max(0, scrollSize - viewportSize)
20
+
21
+ return {
22
+ maxScrollOffset,
23
+ upperDistance: enableUpper ? Math.max(0, -offset) : 0,
24
+ lowerDistance: enableLower
25
+ ? Math.max(0, offset - maxScrollOffset)
26
+ : 0,
27
+ }
28
+ }
@@ -0,0 +1,192 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { runOnBackground, useMainThreadRef } from '@lynx-js/react'
6
+
7
+ import { mtsLog, selectorMT } from '@lynx-js/lynx-ui-common'
8
+ import type { CommonEvent, ScrollEvent } from '@lynx-js/types'
9
+
10
+ import type { BounceableBasicProps, scrollToBouncesInfo } from '../types'
11
+ import { getNativeBounceMetricsMT } from './nativeBounceUtils'
12
+
13
+ interface UseNativeBounceOptions {
14
+ bounceableOptions: BounceableBasicProps
15
+ debugLog?: boolean
16
+ enableRTL?: boolean
17
+ id?: string
18
+ scrollOrientation: 'vertical' | 'horizontal'
19
+ }
20
+
21
+ interface NativeBounceHandlers {
22
+ 'main-thread:bindlayoutchange': (event: CommonEvent) => void
23
+ 'main-thread:bindscroll': (event: ScrollEvent) => void
24
+ 'main-thread:bindscrollend': (event: ScrollEvent) => void
25
+ }
26
+
27
+ export function useNativeBounce(
28
+ options: UseNativeBounceOptions,
29
+ ): NativeBounceHandlers {
30
+ const containerID = options.id ?? 'bounceableContainer'
31
+ const isVertical = options.scrollOrientation === 'vertical'
32
+ const enableRTL = options.enableRTL ?? false
33
+ const debugLogEnabled = Boolean(options.debugLog)
34
+ const height = useMainThreadRef(
35
+ options.bounceableOptions.estimatedHeight ?? 0,
36
+ )
37
+ const width = useMainThreadRef(
38
+ options.bounceableOptions.estimatedWidth ?? 0,
39
+ )
40
+ const maxUpperDistance = useMainThreadRef(0)
41
+ const maxLowerDistance = useMainThreadRef(0)
42
+ const lastBounceDirection = useMainThreadRef<'upper' | 'lower' | null>(null)
43
+
44
+ const singleSidedBounce = options.bounceableOptions.singleSidedBounce
45
+ ?? 'both'
46
+ const enableUpper = singleSidedBounce === 'upper'
47
+ || singleSidedBounce === 'both'
48
+ || singleSidedBounce === 'iOSBounces'
49
+ const enableLower = singleSidedBounce === 'lower'
50
+ || singleSidedBounce === 'both'
51
+ || singleSidedBounce === 'iOSBounces'
52
+
53
+ function setBounceViewOffset(upperDistance: number, lowerDistance: number) {
54
+ 'main thread'
55
+ if (isVertical) {
56
+ selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(
57
+ 'transform',
58
+ `translateY(${upperDistance}px)`,
59
+ )
60
+ selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(
61
+ 'transform',
62
+ `translateY(${-lowerDistance}px)`,
63
+ )
64
+ } else {
65
+ const direction = enableRTL ? -1 : 1
66
+ selectorMT(`${containerID}-upperBounceWrapper`)?.setStyleProperty(
67
+ 'transform',
68
+ `translateX(${direction * upperDistance}px)`,
69
+ )
70
+ selectorMT(`${containerID}-lowerBounceWrapper`)?.setStyleProperty(
71
+ 'transform',
72
+ `translateX(${-direction * lowerDistance}px)`,
73
+ )
74
+ }
75
+ }
76
+
77
+ function onScrollToBouncesJS(info: scrollToBouncesInfo) {
78
+ options.bounceableOptions.onScrollToBounces?.(info)
79
+ }
80
+
81
+ function nativeBounceLayoutChange(event: CommonEvent) {
82
+ 'main thread'
83
+ const isAndroid = SystemInfo.platform === 'Android'
84
+ // @ts-expect-error Expected
85
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
86
+ height.current = (isAndroid ? event.params?.height : event.detail?.height)
87
+ ?? 0
88
+ // @ts-expect-error Expected
89
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
90
+ width.current = (isAndroid ? event.params?.width : event.detail?.width) ?? 0
91
+
92
+ mtsLog(
93
+ debugLogEnabled,
94
+ `[lynx-ui-scroll-view][useNativeBounce] layout change, height: ${height.current}, width: ${width.current}`,
95
+ )
96
+ }
97
+
98
+ function nativeBounceScroll(event: ScrollEvent) {
99
+ 'main thread'
100
+ const offset = isVertical
101
+ ? event.detail.scrollTop
102
+ : event.detail.scrollLeft
103
+ const scrollSize = isVertical
104
+ ? event.detail.scrollHeight
105
+ : event.detail.scrollWidth
106
+ const viewportSize = isVertical ? height.current : width.current
107
+ const {
108
+ maxScrollOffset,
109
+ upperDistance,
110
+ lowerDistance,
111
+ } = getNativeBounceMetricsMT(
112
+ offset,
113
+ scrollSize,
114
+ viewportSize,
115
+ enableUpper,
116
+ enableLower,
117
+ )
118
+
119
+ mtsLog(
120
+ debugLogEnabled,
121
+ `[lynx-ui-scroll-view][useNativeBounce] scroll, offset: ${offset}, scrollSize: ${scrollSize}, viewportSize: ${viewportSize}, maxScrollOffset: ${maxScrollOffset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}`,
122
+ )
123
+
124
+ setBounceViewOffset(upperDistance, lowerDistance)
125
+
126
+ if (upperDistance > 0) {
127
+ maxUpperDistance.current = Math.max(
128
+ maxUpperDistance.current,
129
+ upperDistance,
130
+ )
131
+ lastBounceDirection.current = 'upper'
132
+ } else if (lowerDistance > 0) {
133
+ maxLowerDistance.current = Math.max(
134
+ maxLowerDistance.current,
135
+ lowerDistance,
136
+ )
137
+ lastBounceDirection.current = 'lower'
138
+ }
139
+ }
140
+
141
+ function nativeBounceScrollEnd(event: ScrollEvent) {
142
+ 'main thread'
143
+ const offset = isVertical
144
+ ? event.detail.scrollTop
145
+ : event.detail.scrollLeft
146
+ const scrollSize = isVertical
147
+ ? event.detail.scrollHeight
148
+ : event.detail.scrollWidth
149
+ const viewportSize = isVertical ? height.current : width.current
150
+ const { upperDistance, lowerDistance } = getNativeBounceMetricsMT(
151
+ offset,
152
+ scrollSize,
153
+ viewportSize,
154
+ enableUpper,
155
+ enableLower,
156
+ )
157
+
158
+ setBounceViewOffset(upperDistance, lowerDistance)
159
+
160
+ const direction = lastBounceDirection.current
161
+ const triggerDistance = direction === 'upper'
162
+ ? (options.bounceableOptions.startBounceTriggerDistance ?? 0)
163
+ : (options.bounceableOptions.endBounceTriggerDistance ?? 0)
164
+ const maxDistance = direction === 'upper'
165
+ ? maxUpperDistance.current
166
+ : maxLowerDistance.current
167
+
168
+ mtsLog(
169
+ debugLogEnabled,
170
+ `[lynx-ui-scroll-view][useNativeBounce] scroll end, offset: ${offset}, upperDistance: ${upperDistance}, lowerDistance: ${lowerDistance}, direction: ${
171
+ String(direction)
172
+ }, maxUpperDistance: ${maxUpperDistance.current}, maxLowerDistance: ${maxLowerDistance.current}, triggerDistance: ${triggerDistance}`,
173
+ )
174
+
175
+ if (
176
+ direction !== null
177
+ && maxDistance > triggerDistance
178
+ ) {
179
+ runOnBackground(onScrollToBouncesJS)({ direction })
180
+ }
181
+
182
+ maxUpperDistance.current = 0
183
+ maxLowerDistance.current = 0
184
+ lastBounceDirection.current = null
185
+ }
186
+
187
+ return {
188
+ 'main-thread:bindlayoutchange': nativeBounceLayoutChange,
189
+ 'main-thread:bindscroll': nativeBounceScroll,
190
+ 'main-thread:bindscrollend': nativeBounceScrollEnd,
191
+ }
192
+ }
package/src/index.tsx CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  LayoutEventsMapping,
14
14
  ScrollEventsMapping,
15
15
  TouchEventsMapping,
16
+ nativeLynxSDKVersionLessThan,
16
17
  useRegisteredEvents,
17
18
  } from '@lynx-js/lynx-ui-common'
18
19
  import { LazyComponent } from '@lynx-js/lynx-ui-lazy-component'
@@ -83,6 +84,7 @@ function ScrollViewImpl(
83
84
  },
84
85
  enableScroll = true,
85
86
  enableScrollMonitor = false,
87
+ enableNewArch: enableNewArchProp,
86
88
  scrollMonitorTag,
87
89
  sticky,
88
90
  scrollPropagationBehavior = 'native',
@@ -94,6 +96,8 @@ function ScrollViewImpl(
94
96
  androidTouchSlop,
95
97
  'main-thread:gesture': gesture,
96
98
  } = props
99
+ const enableNewArch = enableNewArchProp
100
+ ?? !nativeLynxSDKVersionLessThan('4.3')
97
101
  // generates binding events dynamically
98
102
  const scrollViewRegisteredEvents = useRef<Record<string, string>>({
99
103
  ...ScrollEventsMapping,
@@ -139,9 +143,12 @@ function ScrollViewImpl(
139
143
  bounceableProps.validAnimationVersion =
140
144
  bounceableOptions.validAnimationVersion ?? true
141
145
  }
142
- // Only when the enableBounces is true and singleSidedBounce is set to 'iOSBounces' will it use default bounces effect on iOS.
143
- const platformBounces = enableBounce
144
- && bounceableProps?.singleSidedBounce === 'iOSBounces'
146
+ // The new architecture provides native bounces on every platform. On the
147
+ // legacy architecture, native bounces are only used for iOSBounces.
148
+ const nativeBounces = enableBounce
149
+ && (enableNewArch
150
+ ? bounceableProps.singleSidedBounce !== 'none'
151
+ : bounceableProps.singleSidedBounce === 'iOSBounces')
145
152
 
146
153
  const shouldEnableNested = () => {
147
154
  if (
@@ -185,6 +192,8 @@ function ScrollViewImpl(
185
192
  type ExtendedScrollViewElementProps = ScrollViewElementProps & {
186
193
  'scroll-x': boolean
187
194
  'scroll-y': boolean
195
+ 'scroll-orientation'?: 'horizontal' | 'vertical'
196
+ 'scroll-view-new-arch'?: boolean
188
197
  }
189
198
  const elementProps: ExtendedScrollViewElementProps & {
190
199
  'enable-scroll-monitor': boolean
@@ -208,6 +217,10 @@ function ScrollViewImpl(
208
217
  'id': scrollviewId,
209
218
  'scroll-x': isHorizontal(),
210
219
  'scroll-y': !isHorizontal(),
220
+ ...(enableNewArch && {
221
+ 'scroll-orientation': isHorizontal() ? 'horizontal' : 'vertical',
222
+ 'scroll-view-new-arch': true,
223
+ }),
211
224
  'enable-scroll-monitor': enableScrollMonitor,
212
225
  'scroll-monitor-tag': scrollMonitorTag,
213
226
  'main-thread:gesture': gesture,
@@ -224,7 +237,7 @@ function ScrollViewImpl(
224
237
  'enable-new-nested': true,
225
238
  'className': className,
226
239
  'style': normalizedStyle,
227
- 'bounces': platformBounces,
240
+ 'bounces': nativeBounces,
228
241
  'enable-scroll': enableScroll,
229
242
  ...(androidTouchSlop !== undefined
230
243
  && { 'android-touch-slop': androidTouchSlop }),
@@ -237,7 +250,32 @@ function ScrollViewImpl(
237
250
  ...registerEvents,
238
251
  }
239
252
 
240
- if (
253
+ if (enableNewArch) {
254
+ if (
255
+ nativeBounces
256
+ && (bounceableProps.upperBounceItem
257
+ || bounceableProps.lowerBounceItem
258
+ || bounceableProps.onScrollToBounces)
259
+ ) {
260
+ return (
261
+ <ScrollViewWithBouncesHook
262
+ elementProps={elementProps}
263
+ bounceableOptions={bounceableProps}
264
+ debugLog={debugLog}
265
+ enableRTL={enableRTL}
266
+ nativeBounces={true}
267
+ sticky={sticky}
268
+ >
269
+ {renderChildren(children, normalizedLazyOptions)}
270
+ </ScrollViewWithBouncesHook>
271
+ )
272
+ }
273
+ return (
274
+ <ScrollViewBasic elementProps={elementProps} sticky={sticky}>
275
+ {renderChildren(children, normalizedLazyOptions)}
276
+ </ScrollViewBasic>
277
+ )
278
+ } else if (
241
279
  enableBounce
242
280
  && bounceableProps.singleSidedBounce !== 'iOSBounces'
243
281
  && bounceableProps.singleSidedBounce !== 'none'
@@ -178,6 +178,15 @@ export interface ScrollViewProps
178
178
  * @Harmony
179
179
  */
180
180
  enableScrollMonitor?: boolean
181
+ /**
182
+ * Enable the native `<scroll-view>` new architecture. When enabled, `bounceableOptions` uses native bounces on Android, iOS, and Harmony. Defaults to `true` on Lynx SDK 4.3 and newer, and `false` on earlier versions.
183
+ * @zh 启用原生 `<scroll-view>` 新架构。启用后,`bounceableOptions` 会在 Android、iOS 和 Harmony 上使用原生回弹。Lynx SDK 4.3 及以上版本默认为 `true`,更早版本默认为 `false`。
184
+ * @defaultValue `true on Lynx SDK >= 4.3; false otherwise`
185
+ * @Android
186
+ * @iOS
187
+ * @Harmony
188
+ */
189
+ enableNewArch?: boolean
181
190
  /**
182
191
  * The tag for scroll monitor.
183
192
  * @zh 滚动监控的标签。