@lynx-js/lynx-ui-scroll-view 0.0.0 → 3.131.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/src/index.tsx ADDED
@@ -0,0 +1,240 @@
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 { forwardRef, memo, useRef } from '@lynx-js/react'
6
+ import type { ForwardedRef, ReactNode } from '@lynx-js/react'
7
+
8
+ import '@lynx-js/gesture-runtime'
9
+ import type { GestureKind } from '@lynx-js/gesture-runtime'
10
+ import type { LazyOptions } from '@lynx-js/lynx-ui-common'
11
+ import {
12
+ ExposureEventsMapping,
13
+ LayoutEventsMapping,
14
+ ScrollEventsMapping,
15
+ TouchEventsMapping,
16
+ useRegisteredEvents,
17
+ } from '@lynx-js/lynx-ui-common'
18
+ import { LazyComponent } from '@lynx-js/lynx-ui-lazy-component'
19
+ import type {
20
+ CSSProperties,
21
+ ScrollViewProps as ScrollViewElementProps,
22
+ } from '@lynx-js/types'
23
+
24
+ import ScrollViewBasic from './ScrollViewBasic'
25
+ import ScrollViewWithBouncesHook from './ScrollViewWithBouncesHook'
26
+ import type {
27
+ BounceableBasicProps,
28
+ ScrollViewProps,
29
+ ScrollViewRef,
30
+ ScrollView as ScrollViewType,
31
+ } from './types'
32
+
33
+ export type { ScrollViewProps, ScrollViewRef }
34
+ export { useBounce } from './hooks/useBounce'
35
+ export type { bounceHandlers } from './hooks/useBounce'
36
+ export type { BounceableBasicProps } from './types'
37
+
38
+ export const ScrollView = memo(forwardRef(ScrollViewImpl)) as ScrollViewType
39
+
40
+ const ScrollViewEventMapping: Record<string, string> = {
41
+ onContentSizeChange: 'bindcontentsizechanged',
42
+ }
43
+
44
+ /**
45
+ * @example
46
+ * ```javascript
47
+ * <ScrollView
48
+ scene={`viewpager_${index1}`}
49
+ style={{ width: '100%', height: '100%' }}
50
+ estimatedItemStyle={{ width: '100%', height: '800px' }}
51
+ scrollOrientation='vertical'
52
+ exposureRight="50px"
53
+ exposureBottom="220px"
54
+ >
55
+ {scrollview.map((item, index) => (
56
+ <view
57
+ style={`width:100%;height:580rpx;`}
58
+ >
59
+ <text>{`slot-${index}`}</text>
60
+ </view>
61
+ ))}
62
+ </ScrollView>
63
+ * ```
64
+ */
65
+ function ScrollViewImpl(
66
+ props: ScrollViewProps,
67
+ _ref: ForwardedRef<ScrollViewRef>,
68
+ ) {
69
+ const {
70
+ scrollviewId = 'scrollview',
71
+ horizontal = false,
72
+ style,
73
+ children,
74
+ scrollOrientation,
75
+ lazyOptions,
76
+ className = '',
77
+ bounceableOptions = {
78
+ enableBounces: true,
79
+ singleSidedBounce: 'iOSBounces',
80
+ },
81
+ enableScroll = true,
82
+ enableScrollMonitor = false,
83
+ scrollMonitorTag,
84
+ sticky,
85
+ scrollPropagationBehavior = 'native',
86
+ temporaryBlockScrollClass = 'BDXLynxViewPager',
87
+ temporaryBlockScrollTag = 0,
88
+ temporaryNestedScroll,
89
+ androidTouchSlop,
90
+ 'main-thread:gesture': gesture,
91
+ } = props
92
+ // generates binding events dynamically
93
+ const scrollViewRegisteredEvents = useRef<Record<string, string>>({
94
+ ...ScrollEventsMapping,
95
+ ...ExposureEventsMapping,
96
+ ...TouchEventsMapping,
97
+ ...LayoutEventsMapping,
98
+ ...ScrollViewEventMapping,
99
+ })
100
+ const normalizedLazyOptions: LazyOptions | undefined = lazyOptions
101
+ ? { firstScreenItemCount: 1, ...lazyOptions }
102
+ : undefined
103
+ const registerEvents = useRegisteredEvents(
104
+ props,
105
+ scrollViewRegisteredEvents.current,
106
+ )
107
+
108
+ const isHorizontal = () => {
109
+ return scrollOrientation ? scrollOrientation === 'horizontal' : horizontal
110
+ }
111
+
112
+ // Initialize bounceableProps
113
+ let enableBounce = false
114
+ let bounceableProps: BounceableBasicProps = { enableBounces: false }
115
+ if (typeof bounceableOptions === 'boolean') {
116
+ // Initialize the default value if the bounceableOptions is simply 'true' without specific options
117
+ enableBounce = bounceableOptions
118
+ bounceableProps = {
119
+ enableBounces: enableBounce,
120
+ singleSidedBounce: 'both',
121
+ alwaysBouncing: true,
122
+ validAnimationVersion: true,
123
+ }
124
+ } else if (typeof bounceableOptions === 'object') {
125
+ enableBounce = bounceableOptions.enableBounces
126
+ bounceableProps = bounceableOptions
127
+ bounceableProps.singleSidedBounce = bounceableOptions.singleSidedBounce
128
+ ?? 'both'
129
+ bounceableProps.alwaysBouncing = bounceableOptions.alwaysBouncing ?? true
130
+ bounceableProps.validAnimationVersion =
131
+ bounceableOptions.validAnimationVersion ?? true
132
+ }
133
+ // Only when the enableBounces is true and singleSidedBounce is set to 'iOSBounces' will it use default bounces effect on iOS.
134
+ const platformBounces = enableBounce
135
+ && bounceableProps?.singleSidedBounce === 'iOSBounces'
136
+
137
+ const shouldEnableNested = () => {
138
+ if (
139
+ SystemInfo.platform === 'iOS' && scrollPropagationBehavior !== 'propagate'
140
+ ) {
141
+ return false
142
+ }
143
+ return true
144
+ }
145
+
146
+ const renderChildren = (
147
+ children: ReactNode,
148
+ lazyOptions: LazyOptions | undefined,
149
+ ) => {
150
+ if (!Array.isArray(children)) {
151
+ return children
152
+ }
153
+ const lazy = lazyOptions?.enableLazy
154
+ return children.map((item: ReactNode, index: number) => {
155
+ if (lazy && index >= Number(lazyOptions?.firstScreenItemCount)) {
156
+ return (
157
+ <LazyComponent
158
+ key={`${scrollviewId}_lazy_${index}`}
159
+ scene={lazyOptions?.scene}
160
+ pid={`pid_${index}`}
161
+ estimatedStyle={lazyOptions?.estimatedItemStyle}
162
+ top={lazyOptions?.exposureTop}
163
+ bottom={lazyOptions?.exposureBottom}
164
+ left={lazyOptions?.exposureLeft}
165
+ right={lazyOptions?.exposureRight}
166
+ >
167
+ {item}
168
+ </LazyComponent>
169
+ )
170
+ }
171
+ return item
172
+ })
173
+ }
174
+
175
+ // These props will be spread directly to <scroll-view> element. Make sure it's valid
176
+ type ExtendedScrollViewElementProps = ScrollViewElementProps & {
177
+ 'scroll-x': boolean
178
+ 'scroll-y': boolean
179
+ }
180
+ const elementProps: ExtendedScrollViewElementProps & {
181
+ 'enable-scroll-monitor': boolean
182
+ 'scroll-monitor-tag'?: string
183
+ 'main-thread:gesture'?: GestureKind
184
+ 'enable-new-nested'?: boolean
185
+ 'enable-nested-scroll'?: boolean
186
+ 'force-can-scroll'?: boolean
187
+ 'ios-block-gesture-class'?: string
188
+ 'ios-recognized-view-tag'?: number
189
+ 'className'?: string
190
+ 'style'?: CSSProperties
191
+ 'bounces'?: boolean
192
+ } = {
193
+ 'id': scrollviewId,
194
+ 'scroll-x': isHorizontal(),
195
+ 'scroll-y': !isHorizontal(),
196
+ 'enable-scroll-monitor': enableScrollMonitor,
197
+ 'scroll-monitor-tag': scrollMonitorTag,
198
+ 'main-thread:gesture': gesture as GestureKind,
199
+ 'force-can-scroll': scrollPropagationBehavior === 'preventPropagate',
200
+ 'ios-block-gesture-class': scrollPropagationBehavior === 'preventPropagate'
201
+ ? temporaryBlockScrollClass
202
+ : '',
203
+ 'ios-recognized-view-tag': scrollPropagationBehavior === 'preventPropagate'
204
+ ? temporaryBlockScrollTag
205
+ : 0,
206
+ 'enable-nested-scroll': SystemInfo.platform === 'Android'
207
+ ? (temporaryNestedScroll ?? true)
208
+ : shouldEnableNested(),
209
+ 'enable-new-nested': true,
210
+ 'className': className,
211
+ 'style': style,
212
+ 'bounces': platformBounces,
213
+ 'enable-scroll': enableScroll,
214
+ ...(androidTouchSlop !== undefined
215
+ && { 'android-touch-slop': androidTouchSlop }),
216
+ ...registerEvents,
217
+ }
218
+
219
+ if (
220
+ enableBounce
221
+ && bounceableProps.singleSidedBounce !== 'iOSBounces'
222
+ && bounceableProps.singleSidedBounce !== 'none'
223
+ ) {
224
+ return (
225
+ <ScrollViewWithBouncesHook
226
+ elementProps={elementProps}
227
+ bounceableOptions={bounceableProps}
228
+ sticky={sticky}
229
+ >
230
+ {renderChildren(children, normalizedLazyOptions)}
231
+ </ScrollViewWithBouncesHook>
232
+ )
233
+ } else {
234
+ return (
235
+ <ScrollViewBasic elementProps={elementProps} sticky={sticky}>
236
+ {renderChildren(children, normalizedLazyOptions)}
237
+ </ScrollViewBasic>
238
+ )
239
+ }
240
+ }
@@ -0,0 +1,397 @@
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 { ReactElement, ReactNode } from '@lynx-js/react'
6
+
7
+ import type { BaseGesture } from '@lynx-js/gesture-runtime'
8
+ import type {
9
+ BaseScrollEvents,
10
+ BaseUIExposureEvents,
11
+ BaseUIExposureProps,
12
+ BaseUILayoutEvents,
13
+ BaseUITouchEvents,
14
+ ComponentBasicProps,
15
+ LazyOptions,
16
+ } from '@lynx-js/lynx-ui-common'
17
+ import type { CSSProperties } from '@lynx-js/types'
18
+
19
+ export type ScrollView = (props: ScrollViewProps) => ReactElement
20
+
21
+ type ScrollPropagationBehaviorOption =
22
+ | 'native' // Follows platform default behavior
23
+ | 'propagate' // Always allow scroll propagation
24
+ // | 'propagateAtEdge' // @todo Child scrolls first; parent scrolls on next touch at edge
25
+ | 'preventPropagate' // Never allow scroll propagation
26
+
27
+ // biome-ignore lint/suspicious/noEmptyInterface: <explanation>
28
+ export interface ScrollViewRef {}
29
+
30
+ export interface ScrollViewProps
31
+ extends
32
+ BaseUITouchEvents,
33
+ BaseScrollEvents,
34
+ BaseUIExposureEvents,
35
+ BaseUILayoutEvents,
36
+ BaseUIExposureProps,
37
+ ComponentBasicProps
38
+ {
39
+ /**
40
+ * The id of the scrollview.
41
+ * @zh 滚动视图的id。
42
+ * @defaultValue "scrollview"
43
+ * @Android
44
+ * @iOS
45
+ */
46
+ scrollviewId?: string
47
+ /**
48
+ * Enable scroll interaction.
49
+ * @zh 启用滚动。
50
+ * @defaultValue true
51
+ * @Android
52
+ * @iOS
53
+ * @Harmony
54
+ */
55
+ enableScroll?: boolean
56
+ /**
57
+ * 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.
58
+ * @zh 开启iOS上的回弹效果。如果想在安卓上使用,请参考bounceableOption。如果设置了bounceableOption,iOSBounces属性将失效。
59
+ * @defaultValue true
60
+ * @Android
61
+ * @iOS
62
+ */
63
+ iOSBounces?: boolean
64
+ /**
65
+ * Testing Mode.
66
+ * @zh 测试模式
67
+ * @Android
68
+ * @iOS
69
+ */
70
+ testing?: boolean
71
+ /**
72
+ * Be used to mark the exposure timing of lazy loading. Please ensure that it is unique throughout the page.
73
+ * @zh 用于标记懒加载的曝光时机。请确保页面中唯一。
74
+ * @Android
75
+ * @iOS
76
+ * @deprecated Please use lazyOptions instead.
77
+ */
78
+ scene?: string
79
+ /**
80
+ * Horizontal scroll.
81
+ * @zh 水平滚动。
82
+ * @deprecated 3.119. Use scrollOrientation instead.
83
+ * @Android
84
+ * @iOS
85
+ */
86
+ horizontal?: boolean
87
+ /**
88
+ * Set to 'vertical' for vertical scrolling and set to 'horizontal' for horizontal scrolling.
89
+ * @zh 设置为 'vertical' 为垂直滚动,设置为 'horizontal' 为水平滚动。
90
+ * @defaultValue 'vertical'
91
+ * @since 3.119
92
+ * @iOS
93
+ * @Android
94
+ * @Harmony
95
+ */
96
+ scrollOrientation?: 'vertical' | 'horizontal'
97
+ /**
98
+ * 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.
99
+ * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。
100
+ * @defaultValue true
101
+ * @Android
102
+ * @iOS
103
+ */
104
+ lazyOptions?: LazyOptions
105
+ /**
106
+ * Estimated height and width of the items need to be set.
107
+ * @zh 需要设置 items 的预计高度和宽度。
108
+ * @Android
109
+ * @iOS
110
+ * @deprecated Please use lazyOptions instead.
111
+ */
112
+ estimatedItemStyle?: CSSProperties
113
+ /**
114
+ * 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.
115
+ * @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。
116
+ * @defaultValue true
117
+ * @Android
118
+ * @iOS
119
+ * @deprecated Please use lazyOptions instead.
120
+ */
121
+ lazy?: boolean
122
+ /**
123
+ * Sticky item, designed for `Tabs`.
124
+ * @zh 粘性元素,设计用于 `Tabs`。
125
+ * @Android
126
+ * @iOS
127
+ */
128
+ sticky?: ReactElement
129
+ /**
130
+ * Children in scroll-view.
131
+ * @zh `scroll-view` 的子元素。
132
+ * @Android
133
+ * @iOS
134
+ */
135
+ children?: ReactNode
136
+ /**
137
+ * exposure-screen-margin-top
138
+ * @zh 曝光屏幕上方边距
139
+ * @defaultValue '10px'
140
+ * @Android
141
+ * @iOS
142
+ * @deprecated Please use lazyOptions instead.
143
+ */
144
+ exposureTop?: string
145
+ /**
146
+ * exposure-screen-margin-bottom
147
+ * @zh 曝光屏幕下方边距
148
+ * @defaultValue '10px'
149
+ * @Android
150
+ * @iOS
151
+ * @deprecated Please use lazyOptions instead.
152
+ */
153
+ exposureBottom?: string
154
+ /**
155
+ * exposure-screen-margin-left
156
+ * @zh 曝光屏幕左侧边距
157
+ * @defaultValue '10px'
158
+ * @Android
159
+ * @iOS
160
+ * @deprecated Please use lazyOptions instead.
161
+ */
162
+ exposureLeft?: string
163
+ /**
164
+ * exposure-screen-margin-right
165
+ * @zh 曝光屏幕右侧边距
166
+ * @defaultValue '10px'
167
+ * @Android
168
+ * @iOS
169
+ * @deprecated Please use lazyOptions instead.
170
+ */
171
+ exposureRight?: string
172
+ /**
173
+ * Enable scroll monitor.
174
+ * @zh 启用滚动监控。
175
+ * @defaultValue false
176
+ * @iOS
177
+ * @Android
178
+ * @Harmony
179
+ */
180
+ enableScrollMonitor?: boolean
181
+ /**
182
+ * The tag for scroll monitor.
183
+ * @zh 滚动监控的标签。
184
+ * @defaultValue false
185
+ * @iOS
186
+ * @Android
187
+ * @Harmony
188
+ */
189
+ scrollMonitorTag?: string
190
+ /**
191
+ * 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.
192
+ * @zh 懒加载时预计的第一页项数。剩余的子元素会基于曝光状态完成渲染。当此预估较小时,可能会导致第一屏出现空白现象。
193
+ * @defaultValue 1
194
+ * @Android
195
+ * @iOS
196
+ * @deprecated Please use lazyOptions instead.
197
+ */
198
+ firstScreenItemCount?: number
199
+ /**
200
+ * Enable bouncing effect
201
+ * @zh 启用弹性效果
202
+ * @Android
203
+ * @iOS
204
+ * @deprecated Please use bounceableOptions instead.
205
+ */
206
+ bounceable?: boolean
207
+ /**
208
+ * Props for bouncing effect
209
+ * @zh 弹性效果的参数
210
+ * @defaultValue { enableBounces: true, singleSidedBounce: "iOSBounces" },
211
+ * @Android
212
+ * @iOS
213
+ */
214
+ bounceableOptions?: boolean | BounceableBasicProps
215
+ /**
216
+ * Controls whether scroll events propagate to parent containers. For now, 'preventPropagate' needs to be used together with temporaryBlockScrollClass and temporaryBlockScrollTag on iOS.
217
+ * @zh 控制滚动事件是否向父级容器传递。'preventPropagate' 在 iOS 上暂时需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。
218
+ * @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`.
219
+ * @defaultValue 'native'
220
+ * @iOS
221
+ * @Android
222
+ */
223
+ scrollPropagationBehavior?: ScrollPropagationBehaviorOption
224
+ /**
225
+ * 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.
226
+ * @zh 当 scrollPropagationBehavior 设为 'preventPropagate' 时,被阻止滚动的容器的具体类名。'preventPropagate' 需与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。
227
+ * This is a temporary props and will be deprecated on new Lynx SDK version.
228
+ * @defaultValue 'BDXLynxViewPager'
229
+ * @iOS
230
+ */
231
+ temporaryBlockScrollClass?: string
232
+ /**
233
+ * 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.
234
+ * @zh 用于指定当 scrollPropagationBehavior 设为 'preventPropagate' 时被阻止滚动的原生容器标签(对应 UIView 的 Tag 属性)。该值需由原生容器提供方指定,且 'preventPropagate' 必须与 temporaryBlockScrollClass 和 temporaryBlockScrollTag 配合使用。
235
+ * This is a temporary props and will be deprecated on new Lynx SDK version.
236
+ * @defaultValue 0
237
+ * @iOS
238
+ */
239
+ temporaryBlockScrollTag?: number
240
+ /**
241
+ * Android-only temporary flag to control nested scroll; maps to native 'enable-nested-scroll'. Android default value is true.
242
+ * @zh 仅 Android 生效的临时开关,用于控制嵌套滚动冲突;映射到原生属性 'enable-nested-scroll'。Android上默认开启。
243
+ * @Android
244
+ */
245
+ temporaryNestedScroll?: boolean
246
+ /**
247
+ * If you want to use gesture, pass it here.
248
+ * @zh 如果想使用 gesture API,请传入该属性。
249
+ * @iOS
250
+ * @Android
251
+ */
252
+ 'main-thread:gesture'?: BaseGesture
253
+
254
+ /**
255
+ * Android touch recognition mode. When inside a component that supports 'paging' mode, 'paging' must be enabled.
256
+ * @zh Android 触摸识别模式,当处于支持 'paging' 模式的元件中时,需要开启 'paging' 模式。
257
+ * @Android
258
+ */
259
+ androidTouchSlop?: 'default' | 'paging'
260
+
261
+ /**
262
+ * Being triggered when scrolling content changes.
263
+ * @zh 滚动内容变化时触发。
264
+ * @eventProperty
265
+ * @Android
266
+ * @iOS
267
+ */
268
+ onContentSizeChange?: (res: {
269
+ detail: { scrollWidth: number, scrollHeight: number }
270
+ }) => void
271
+ }
272
+
273
+ export interface scrollToBouncesInfo {
274
+ direction: 'upper' | 'lower'
275
+ }
276
+
277
+ export interface BounceableBasicProps {
278
+ /**
279
+ * Whether to enable bounce effect
280
+ * @zh 是否开启回弹效果
281
+ * @iOS
282
+ * @Android
283
+ * @Harmony
284
+ */
285
+ enableBounces: boolean
286
+ /**
287
+ * Trigger bounces effect during fling
288
+ * @zh 在快速滑动(fling)时触发回弹效果
289
+ * @defaultValue false
290
+ * @iOS
291
+ * @Android
292
+ * @Harmony
293
+ */
294
+ enableBounceEventInFling?: boolean
295
+ /**
296
+ * The threshold distance of upper bounces, in pixels, when triggering the scrollToBounces event
297
+ * @zh 触发 `scrollToBounces` 事件时,上部回弹的阈值距离(单位:px)
298
+ * @defaultValue 0
299
+ * @iOS
300
+ * @Android
301
+ * @Harmony
302
+ */
303
+ startBounceTriggerDistance?: number
304
+ /**
305
+ * The threshold distance of lower bounces, in pixels, when triggering the scrollToBounces event
306
+ * @zh 触发 `scrollToBounces` 事件时,下部回弹的阈值距离(单位:px)
307
+ * @defaultValue 0
308
+ * @iOS
309
+ * @Android
310
+ * @Harmony
311
+ */
312
+ endBounceTriggerDistance?: number
313
+ /**
314
+ * Content of upper bounces view, which will be displayed during the upper bouncing effect.
315
+ * @zh 上部回弹视图的内容,将在上部回弹效果期间显示。
316
+ * @iOS
317
+ * @Android
318
+ * @Harmony
319
+ */
320
+ // biome-ignore lint/suspicious/noExplicitAny: expected
321
+ upperBounceItem?: any
322
+ /**
323
+ * Content of lower bounces view, which will be displayed during the lower bouncing effect.
324
+ * @zh 下部回弹视图的内容,将在下部回弹效果期间显示。
325
+ * @iOS
326
+ * @Android
327
+ * @Harmony
328
+ */
329
+ // biome-ignore lint/suspicious/noExplicitAny: expected
330
+ lowerBounceItem?: any
331
+ /**
332
+ * Whether the scrollable container can bounce when the content area of the scrollable container is smaller than the viewport area.
333
+ * @zh 当可滚动容器的内容区域小于视口区域时,是否允许容器回弹。
334
+ * @defaultValue true
335
+ * @iOS
336
+ * @Android
337
+ * @Harmony
338
+ */
339
+ alwaysBouncing?: boolean
340
+ /**
341
+ * The direction of the bounce effect. 'both' for bouncing on both ends, 'none' to disable bounce, and 'upper'/'lower' for bouncing on either end
342
+ * @zh 回弹效果的方向。'both' 表示两端都回弹,'none' 表示禁用回弹,'upper'/'lower' 表示只在上端或下端回弹。
343
+ * @defaultValue 'both'
344
+ * @iOS
345
+ * @Android
346
+ * @Harmony
347
+ */
348
+ singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none'
349
+ /**
350
+ * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
351
+ * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
352
+ * @Android
353
+ * @iOS
354
+ * @Harmony
355
+ */
356
+ estimatedHeight?: number
357
+ /**
358
+ * Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
359
+ * @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
360
+ * @Android
361
+ * @iOS
362
+ * @Harmony
363
+ */
364
+ estimatedWidth?: number
365
+ /**
366
+ * Display debug logs. Open it when you find a bug.
367
+ * @zh 显示调试日志。当您发现错误时,请打开此选项。
368
+ * @defaultValue false
369
+ * @iOS
370
+ * @Android
371
+ * @Harmony
372
+ */
373
+ debugLog?: boolean
374
+ /**
375
+ * requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.
376
+ * @zh `requestAnimationFrame` 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。
377
+ * @defaultValue false
378
+ * @iOS
379
+ * @Android
380
+ * @Harmony
381
+ */
382
+ validAnimationVersion?: boolean
383
+ /**
384
+ * 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.
385
+ * @zh 当触发回弹效果并且回弹距离在上侧或下侧大于 `startBounceDistance` 或 `endBounceDistance` 时,将触发 `scrollToBounces` 事件。
386
+ * @defaultValue 0
387
+ * @eventProperty
388
+ * @iOS
389
+ * @Android
390
+ * @Harmony
391
+ */
392
+ onScrollToBounces?: (e: scrollToBouncesInfo) => void
393
+ }
394
+
395
+ export const ScrollEventMapping: Record<string, string> = {
396
+ onContentSizeChange: 'bindcontentsizechange',
397
+ }
@@ -0,0 +1,5 @@
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
+ export type * from './index.docs'
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tools/configs/tsconfig.docs.json",
3
+ "include": [
4
+ "src",
5
+ "dist/types/index.docs.d.ts"
6
+ ]
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tools/configs/tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ },
6
+ "include": [
7
+ "src",
8
+ ],
9
+ }
File without changes