@lynx-js/types 3.4.11 → 3.5.9

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.
@@ -1,1144 +1,724 @@
1
- // Copyright 2024 The Lynx Authors. All rights reserved.
1
+ // Copyright 2025 The Lynx Authors. All rights reserved.
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { AppearanceEvent, BaseEvent, BaseMethod, EventHandler } from '../events';
5
+ import { BaseEvent, BaseMethod, EventHandler } from '../events';
6
6
  import { StandardProps } from '../props';
7
7
 
8
- export enum ListEventSource {
9
- DIFF = 0,
10
- LAYOUT = 1,
11
- SCROLL = 2,
12
- }
13
-
14
- /** The enum value of list batch render strategy.
15
- * DEFAULT: The default value with the normal list's rendering process.
16
- * BATCH_RENDER: Use batch render and the list will batch render multiple items.
17
- * ASYNC_RESOLVE_PROPERTY: Use batch render and enable async resolve property of the list item.
18
- * ASYNC_RESOLVE_PROPERTY_AND_ELEMENT_TREE (Recommended): Use batch render and enable async resolve property and element tree of the list item.
8
+ /**
9
+ * The scroll state of the list.
10
+ * SCROLL_STATE_STOP: In an idle, settled state.
11
+ * SCROLL_STATE_DRAGGING: Is currently being dragged by outside input such as user touch.
12
+ * SCROLL_STATE_DECELERATE: Is currently animating to a final position triggered by fling.
13
+ * SCROLL_STATE_ANIMATION: Is currently animating to a final position triggered by smooth scroll.
19
14
  * @Android
20
15
  * @iOS
16
+ * @Harmony
17
+ * @PC
21
18
  */
22
- export enum BatchRenderStrategy {
23
- DEFAULT = 0,
24
- BATCH_RENDER = 1,
25
- ASYNC_RESOLVE_PROPERTY = 2,
26
- ASYNC_RESOLVE_PROPERTY_AND_ELEMENT_TREE = 3
19
+ export enum ListScrollState {
20
+ SCROLL_STATE_STOP = 1,
21
+ SCROLL_STATE_DRAGGING = 2,
22
+ SCROLL_STATE_DECELERATE = 3,
23
+ SCROLL_STATE_ANIMATION = 4,
27
24
  }
28
25
 
29
- export interface ListScrollInfo {
30
- /**
31
- * scroll left from start
32
- * @Android
33
- * @iOS
34
- */
35
- scrollLeft: number;
36
- /**
37
- * scroll top from start
38
- * @Android
39
- * @iOS
40
- */
41
- scrollTop: number;
42
- /**
43
- * scroll content width
44
- * @Android
45
- * @iOS
46
- */
47
- scrollWidth: number;
48
- /**
49
- * scroll content height
50
- * @Android
51
- * @iOS
52
- */
53
- scrollHeight: number;
54
- /**
55
- * list width
56
- * @Android
57
- * @iOS
58
- */
59
- listWidth: number;
60
- /**
61
- * list height
62
- * @Android
63
- * @iOS
64
- */
65
- listHeight: number;
66
- /**
67
- * X-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
68
- * @Android
69
- * @iOS
70
- */
71
- deltaX: number;
72
- /**
73
- * Y-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
74
- * @Android
75
- * @iOS
76
- */
77
- deltaY: number;
78
- /**
79
- * Source of the event.
80
- * @Android
81
- * @iOS
82
- */
83
- eventSource: ListEventSource;
84
- /**
85
- * attached cells
86
- * @iOS
87
- * @Android
88
- */
89
- attachedCells: ListAttachedCell[];
26
+ /**
27
+ * The source of the scroll event.
28
+ * @Android
29
+ * @iOS
30
+ * @Harmony
31
+ * @PC
32
+ */
33
+ export enum ListEventSource {
34
+ DIFF = 0,
35
+ LAYOUT = 1,
36
+ SCROLL = 2,
90
37
  }
91
38
 
92
- export interface ListScrollEvent extends BaseEvent<'scroll', ListScrollInfo> {}
93
- export interface ListScrollToLowerEvent extends BaseEvent<'scrolltolower', ListScrollInfo> {}
94
- export interface ListScrollToUpperEvent extends BaseEvent<'scrolltoupper', ListScrollInfo> {}
95
- export interface ListScrollToUpperEdgeEvent extends BaseEvent<'scrolltoupperedge', ListScrollInfo> {}
96
- export interface ListScrollToLowerEdgeEvent extends BaseEvent<'scrolltoloweredge', ListScrollInfo> {}
97
- export interface ListScrollToNormalStateEvent extends BaseEvent<'scrolltonormalstate', ListScrollInfo> {}
98
-
99
- export interface ListItemSnapAlignment {
100
- /**
101
- * Paging factor, 0.0 means align to the top, while 1.0 means align to the bottom.
102
- * @Android
103
- * @iOS
104
- */
105
- factor: number;
39
+ export interface ListAttachedCell {
106
40
  /**
107
- * In addition to the parameter of factor, an offset for alignment can be set, in px.
108
- * @Android
41
+ * id of list item
109
42
  * @iOS
110
- */
111
- offset: number;
112
- }
113
-
114
- export interface ListItemInfo {
115
- /**
116
- * Height of the item, in px.
117
43
  * @Android
118
- * @iOS
119
- * @H
44
+ * @Harmony
45
+ * @PC
120
46
  */
121
- height: number;
47
+ id: string;
122
48
  /**
123
- * Width of the item, in px.
124
- * @Android
49
+ * item-key of list item
125
50
  * @iOS
126
- * @H
127
- */
128
- width: number;
129
- /**
130
- * ItemKey of the list-item.
131
51
  * @Android
132
- * @iOS
133
- * @H
52
+ * @Harmony
53
+ * @PC
134
54
  */
135
55
  itemKey: string;
136
56
  /**
137
- * When the list is running in multi-thread mode, this property indicates whether the item is currently being rendered and has not finished rendering. In this state, the item will have a default height that is the same as the list's height or an estimated height if one has been set.
138
- * @Android
139
- * @iOS
140
- * @H
141
- */
142
- isBinding: boolean;
143
- /**
144
- * The x coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
145
- * @Android
146
- * @iOS
147
- * @H
148
- */
149
- originX: number;
150
- /**
151
- * The y coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
152
- * @Android
153
- * @iOS
154
- * @H
155
- */
156
- originY: number;
157
- /**
158
- * Show if the list-item is currently being updated in this layout.
159
- * @Android
160
- * @iOS
161
- * @H
162
- */
163
- updated: boolean;
164
- }
165
-
166
- export interface ListAttachedCell {
167
- /**
168
- * id
57
+ * index of list item
169
58
  * @iOS
170
59
  * @Android
60
+ * @Harmony
61
+ * @PC
171
62
  */
172
- id: string;
63
+ index: number;
173
64
  /**
174
- * bottom
65
+ * left position of list item relative to list, in px
175
66
  * @iOS
176
67
  * @Android
68
+ * @Harmony
69
+ * @PC
177
70
  */
178
- bottom: number;
71
+ left: number;
179
72
  /**
180
- * top
73
+ * top position of list item relative to list, in px
181
74
  * @iOS
182
75
  * @Android
76
+ * @Harmony
77
+ * @PC
183
78
  */
184
79
  top: number;
185
80
  /**
186
- * left
187
- * @iOS
188
- * @Android
189
- */
190
- left: number;
191
- /**
192
- * right
81
+ * right position of list item relative to list, in px
193
82
  * @iOS
194
83
  * @Android
84
+ * @Harmony
85
+ * @PC
195
86
  */
196
87
  right: number;
197
88
  /**
198
- * postion
89
+ * bottom position of list item relative to list, in px
199
90
  * @iOS
200
91
  * @Android
92
+ * @Harmony
93
+ * @PC
201
94
  */
202
- position: number;
95
+ bottom: number;
203
96
  }
204
97
 
205
- export interface ListDetail {
206
- /**
207
- * scroll top from start
208
- * @iOS
209
- * @Android
210
- */
211
- scrollTop: number;
98
+ export interface ListScrollInfo {
212
99
  /**
213
- * scrolling delta at y axis
214
- * @iOS
100
+ * Horizontal scroll offset since the last scroll, in px.
215
101
  * @Android
216
- */
217
- deltaY: number;
218
- /**
219
- * attached cells
220
102
  * @iOS
221
- * @Android
103
+ * @Harmony
104
+ * @PC
222
105
  */
223
- attachedCells: ListAttachedCell[];
224
- }
225
-
226
- export interface ListEvent<T> extends BaseEvent<T, ListDetail> {}
227
-
228
- export enum ListScrollState {
229
- SCROLL_STATE_STOP = 1,
230
- SCROLL_STATE_DRAGGING = 2,
231
- SCROLL_STATE_DECELERATE = 3,
232
- }
233
-
234
- export interface ListScrollStateChangeEvent extends BaseEvent<'scrollstatechange', {}> {
235
- detail: {
236
- /**
237
- * scroll state
238
- * @iOS
239
- * @Android
240
- */
241
- state: ListScrollState;
242
- };
243
- }
244
-
245
- export interface ListLayoutFinishEvent extends BaseEvent<'layoutcomplete', {}> {
246
- detail: {
247
- /**
248
- * timestamp, in ms
249
- * @iOS
250
- * @Android
251
- */
252
- timestamp: number;
253
- /**
254
- * All the component names after this layout
255
- * @iOS
256
- * @Android
257
- */
258
- cells: string[];
259
- };
260
- }
261
-
262
- interface ListDebugInfoEvent extends BaseEvent<'debuginfo', {}> {
263
- detail: {};
264
- }
265
-
266
- export interface ListSnapEvent extends BaseEvent<'snap', {}> {
267
- detail: {
268
- /**
269
- * Will snap to a position.
270
- * @iOS
271
- * @Android
272
- */
273
- position: number;
274
- /**
275
- * Current scrolling left offset, in px.
276
- * @iOS
277
- * @Android
278
- */
279
- currentScrollLeft: number;
280
- /**
281
- * Current scrolling top offset, in px.
282
- * @iOS
283
- * @Android
284
- */
285
- currentScrollTop: number;
286
- /**
287
- * Snap scrolling left offset, in px.
288
- * @iOS
289
- * @Android
290
- */
291
- targetScrollLeft: number;
292
- /**
293
- * Snap scrolling top offset, in px.
294
- * @iOS
295
- * @Android
296
- */
297
- targetScrollTop: number;
298
- };
299
- }
300
-
301
- export interface LayoutCompleteEvent extends BaseEvent<'layoutcomplete', {}> {
106
+ deltaX: number;
302
107
  /**
303
- * Layout details
304
- * @iOS
108
+ * Vertical scroll offset since the last scroll, in px.
305
109
  * @Android
306
- * @H
307
- * @Since 2.15
308
- */
309
- detail: {
310
- /**
311
- * Connected to a setState.
312
- * @iOS
313
- * @Android
314
- * @H
315
- */
316
- 'layout-id': number;
317
- /**
318
- * The diffResult of current layout change. If this diffResult is undefined, it means that the layout is triggered by a list-item update.
319
- * @iOS
320
- * @Android
321
- * @H
322
- */
323
- diffResult?: {
324
- insertions: number[];
325
- // eslint-disable-next-line
326
- move_from: number[];
327
- // eslint-disable-next-line
328
- move_to: number[];
329
- removals: number[];
330
- // eslint-disable-next-line
331
- update_from: number[];
332
- // eslint-disable-next-line
333
- update_to: number[];
334
- };
335
- /**
336
- * Cell info of the list after layout.
337
- * @iOS
338
- * @Android
339
- * @H
340
- */
341
- visibleItemAfterUpdate?: ListItemInfo[];
342
- /**
343
- * Cell info of the list before layout.
344
- * @iOS
345
- * @Android
346
- * @H
347
- */
348
- visibleItemBeforeUpdate?: ListItemInfo[];
349
- /**
350
- * The scroll info after layout.
351
- * @iOS
352
- * @Android
353
- * @H
354
- */
355
- scrollInfo: ListScrollInfo;
356
- /**
357
- * The unit of event's parameters.
358
- * @iOS
359
- * @Android
360
- * @H
361
- */
362
- eventUnit: string;
363
- };
364
- }
365
-
366
- /**
367
- * list. A list does not support adaptive height and the 'height' property must be specified for the <list> tag in order to set its height.
368
- */
369
- export interface ListProps extends StandardProps {
370
- /**
371
- * Whether to display the scrollbar of the list
372
- * @defaultValue true
373
110
  * @iOS
111
+ * @Harmony
112
+ * @PC
374
113
  */
375
- 'scroll-bar-enable'?: boolean;
376
-
377
- /**
378
- * Control whether list should produce bounces effect when scrolling past its content boundaries.
379
- * @defaultValue true
380
- * @iOS
381
- */
382
- bounces?: boolean;
383
-
384
- /**
385
- * z-index is undefined by default. When enabled, z-index will be assigned in ascending order for each item.
386
- * @defaultValue false
387
- * @iOS
388
- */
389
- 'ios-index-as-z-index'?: boolean;
390
-
391
- /**
392
- * To solve the flickering issue of list, it's recommended to enable it.
393
- * @defaultValue false
394
- * @iOS
395
- */
396
- 'ios-fixed-content-offset'?: boolean;
397
-
398
- /**
399
- * To solve the flickering issue of list, it's only necessary to enable when using bottom-up layout. It's recommended to understand the principle before using.
400
- * @defaultValue false
401
- * @iOS
402
- */
403
- 'ios-fix-offset-from-start'?: boolean;
404
-
405
- /**
406
- * Interrupt List rendering switch. It is usually used when creating drag-and-drop effects to prevent the list from refreshing child nodes.
407
- * @defaultValue false
408
- * @Android
409
- */
410
- 'no-invalidate'?: boolean;
411
-
412
- /**
413
- * Under asynchronous layout, it is recommended to enable this property if a child node renders blank.
414
- * @defaultValue false
415
- * @Android
416
- */
417
- 'component-init-measure'?: boolean;
418
-
114
+ deltaY: number;
419
115
  /**
420
- * Control whether dataSet can be used as the unique identifier. It will call RecyclerView.setHasStableIds() internally.
421
- * @defaultValue false
116
+ * Current horizontal scroll offset, in px.
422
117
  * @Android
423
- */
424
- 'android-diffable'?: boolean;
425
-
426
- /**
427
- * ”upperBounce“ can only forbid bounces effect at top or left (right for RTL); ”lowerBounce“ can only forbid bounces effect at bottom or right (left for RTL). iOS uses bounces to implement refresh-view. This prop can be used when you need a refresh-view without bounces on the other side.
428
- * @defaultValue "none"
429
118
  * @iOS
119
+ * @Harmony
120
+ * @PC
430
121
  */
431
- 'ios-forbid-single-sided-bounce'?: 'upperBounce' | 'lowerBounce' | 'none';
432
-
122
+ scrollLeft: number;
433
123
  /**
434
- * Control whether list should produce over-scroll effect when scrolling past its content boundaries.
435
- * @defaultValue false
124
+ * Current vertical scroll offset, in px.
436
125
  * @Android
126
+ * @iOS
127
+ * @Harmony
128
+ * @PC
437
129
  */
438
- 'over-scroll'?: boolean;
439
-
130
+ scrollTop: number;
440
131
  /**
441
- * Whether to allow scrolling for a list.
442
- * @defaultValue true
132
+ * Current content area width, in px.
443
133
  * @Android
444
134
  * @iOS
135
+ * @Harmony
136
+ * @PC
445
137
  */
446
- 'enable-scroll'?: boolean;
447
-
138
+ scrollWidth: number;
448
139
  /**
449
- * Whether to allow scrolling for a list. It's recommended to enable 'enable-scroll=true' and disable 'touch-scroll' on Android.
450
- * @defaultValue true
140
+ * Current content area height, in px.
451
141
  * @Android
142
+ * @iOS
143
+ * @Harmony
144
+ * @PC
452
145
  */
453
- 'touch-scroll'?: boolean;
454
-
146
+ scrollHeight: number;
455
147
  /**
456
- * layout type of the list
457
- * @defaultValue "single"
148
+ * list width, in px.
458
149
  * @Android
459
150
  * @iOS
151
+ * @Harmony
152
+ * @PC
460
153
  */
461
- 'list-type'?: 'single' | 'flow' | 'waterfall';
462
-
154
+ listWidth: number;
463
155
  /**
464
- * The number of columns for a list, only effective when list-type is 'flow' or 'waterfall'.
465
- * @defaultValue 0
156
+ * list height, in px.
466
157
  * @Android
467
158
  * @iOS
159
+ * @Harmony
160
+ * @PC
468
161
  */
469
- 'column-count'?: number;
470
-
162
+ listHeight: number;
471
163
  /**
472
- * Control the horizontal and vertical scrolling direction of a list. If it is horizontal scrolling, you need to also set the CSS layout property 'style="display:linear; linear-orientation:horizontal"
473
- * @defaultValue undefined
164
+ * Source of the event.
474
165
  * @Android
475
166
  * @iOS
167
+ * @Harmony
168
+ * @PC
476
169
  */
477
- 'vertical-orientation'?: boolean;
478
-
170
+ eventSource: ListEventSource;
479
171
  /**
480
- * Replacement of vertical-orientation
481
- * @since 3.0
172
+ * Information of the currently rendering list items.
482
173
  * @iOS
483
174
  * @Android
484
- * @H
485
- */
486
- 'scroll-orientation'?: 'vertical' | 'horizontal';
487
-
488
- /**
489
- * Control the list to fill the elements from the bottom. It is used in reverse layout scenarios such as message list.
490
- * @defaultValue false
491
- * @Android
492
- */
493
- 'android-stack-from-end'?: boolean;
494
-
495
- /**
496
- * Control the switch of RTL (Right-to-Left) mode, the order of vertical two-column layout will also be mirrored and upside-down.
497
- * @defaultValue false
498
- * @Android
499
- * @iOS
175
+ * @Harmony
176
+ * @PC
500
177
  */
501
- 'enable-rtl'?: boolean;
178
+ attachedCells: ListAttachedCell[];
179
+ }
502
180
 
181
+ export interface ListItemInfo {
503
182
  /**
504
- * The ceiling or floor effect is not compatible with flatten.
505
- * @defaultValue false
183
+ * Height of the list item, in px.
506
184
  * @Android
507
185
  * @iOS
186
+ * @Harmony
187
+ * @PC
508
188
  */
509
- sticky?: boolean;
510
-
189
+ height: number;
511
190
  /**
512
- * The distance between the ceiling or floor position and the top or bottom of the list, in pixels.
513
- * @defaultValue 0
191
+ * Width of the list item, in px.
514
192
  * @Android
515
193
  * @iOS
194
+ * @Harmony
195
+ * @PC
516
196
  */
517
- 'sticky-offset'?: number;
518
-
197
+ width: number;
519
198
  /**
520
- * The property to control whether recycle sticky item. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
521
- * @defaultValue false
199
+ * ItemKey of the list-item.
522
200
  * @Android
523
201
  * @iOS
202
+ * @Harmony
203
+ * @PC
524
204
  */
525
- 'experimental-recycle-sticky-item'?: boolean;
526
-
205
+ itemKey: string;
527
206
  /**
528
- * The property to set the capacity of sticky item cache. The default value is 1 if thread mode is ALL_ON_UI and 2 if thread mode is MOST_ON_TASM / PART_ON_LAYOUT / MULTI_THREADS.
529
- * @defaultValue 1
207
+ * When the list is running in multi-thread mode, this property indicates whether the item is currently being rendered and has not finished rendering. In this state, the item will have a default height that is the same as the list's height or an estimated height if one has been set.
530
208
  * @Android
531
209
  * @iOS
210
+ * @Harmony
211
+ * @PC
532
212
  */
533
- 'sticky-buffer-count'?: number;
534
-
535
- /**
536
- * When enabled, the upper or lower element will also be shifted together with the bounces effect.
537
- * @defaultValue false
538
- * @iOS
539
- */
540
- 'sticky-with-bounces'?: boolean;
541
-
213
+ isBinding: boolean;
542
214
  /**
543
- * Rollback to the older version's sticky feature.
544
- * @defaultValue false
215
+ * The x coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
545
216
  * @Android
546
217
  * @iOS
547
- * @deprecated since 2.14
548
- */
549
- 'use-old-sticky'?: boolean;
550
-
551
- /**
552
- * To solve the conflict between list and x-refresh-view
553
- * @defaultValue false
554
- * @experimental
555
- * @iOS
556
- * @since 2.18
218
+ * @Harmony
219
+ * @PC
557
220
  */
558
- 'experimental-disable-filter-scroll'?: boolean;
559
-
221
+ originX: number;
560
222
  /**
561
- * Limit the inertia scrolling distance of asynchronous list to this value multiplied by the height (width) of the list, in order to reduce the chance of white screen. When it is set to 'auto', it will automatically calculate the rendering distance in preload-buffer when asynchronous list is enabled to ensure there is no white screen, but the inertia scrolling experience may be abnormal.
562
- * @defaultValue undefined
563
- * @experimental
223
+ * The y coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
564
224
  * @Android
565
225
  * @iOS
566
- * @since 2.17
567
- */
568
- 'experimental-max-fling-distance-ratio'?: 'auto' | number;
569
-
570
- /**
571
- * Attempt to increase the CPU frequency if a gesture is set to the list
572
- * @defaultValue false
573
- * @experimental
574
- * @iOS
575
- * @since 2.18
226
+ * @Harmony
227
+ * @PC
576
228
  */
577
- 'experimental-ios-gesture-frequency-increasing'?: boolean;
578
-
229
+ originY: number;
579
230
  /**
580
- * On iOS, force-can-scroll should be used with ios-block-gesture-class and ios-recognized-view-tag. Can be used alone on Android.
581
- * @defaultValue false
582
- * @iOS
231
+ * Show if the list-item is currently being updated in this layout.
583
232
  * @Android
584
- * @since 3.1
585
- */
586
- 'force-can-scroll'?: boolean;
587
-
588
- /**
589
- * Whether to scroll to the top when the iOS status bar is clicked. Note that even if it is set to true, it may not scroll to the top. In such cas, you need to check the behavior of other scrollable components.{@link https://developer.apple.com/documentation/uikit/uiscrollview/1619421-scrollstotop?language=objc | Reference }
590
- * @defaultValue undefined
591
- * @iOS
592
- * @since 2.16
593
- */
594
- 'ios-scrolls-to-top'?: boolean;
595
-
596
- /**
597
- * There are stability issues. Please use `<Component align-height={true}/>` instead. It is not recommended to use.
598
- * @defaultValue false
599
- * @iOS
600
- * @deprecated since 2.10
601
- */
602
- 'ios-enable-align-height'?: boolean;
603
-
604
- /**
605
- * Deprecated
606
- * @defaultValue true
607
- * @iOS
608
- * @deprecated since 2.10
609
- */
610
- 'ios-no-recursive-layout'?: boolean;
611
-
612
- /**
613
- * Deprecated
614
- * @defaultValue true
615
233
  * @iOS
616
- * @deprecated since 2.10
617
- */
618
- 'ios-force-reload-data'?: boolean;
619
-
620
- /**
621
- * Deprecated
622
- * @defaultValue true
623
- * @iOS
624
- * @deprecated since 2.10
625
- */
626
- 'ios-update-valid-layout'?: boolean;
627
-
628
- /**
629
- * Deprecated
630
- * @defaultValue false
631
- * @iOS
632
- * @deprecated since 2.10
633
- */
634
- 'ios-enable-adjust-offset-for-selfsizing'?: boolean;
635
-
636
- /**
637
- * In Android, this attribute controls whether the list uses the RecyclerView's ItemDecoration to implement the main-axis-gap and cross-axis-gap.
638
- * @defaultValue false
639
- * @Android
640
- */
641
- 'android-enable-gap-item-decoration'?: boolean;
642
-
643
- /**
644
- * In some Android scenarios, the element that is currently being ceilinged or floored may not be correctly measured and laid out, resulting in blank rendering. Therefore, it is recommended to enable it.
645
- * @defaultValue false
646
- * @Android
234
+ * @Harmony
235
+ * @PC
647
236
  */
648
- 'android-trigger-sticky-layout'?: boolean;
237
+ updated: boolean;
238
+ }
649
239
 
240
+ export interface ListScrollStateInfo {
650
241
  /**
651
- * Specify this property as 'default' to enable update animation for the list.
652
- * @defaultValue "none"
653
- * @Android
242
+ * scroll state
654
243
  * @iOS
655
- */
656
- 'update-animation'?: 'none' | 'default';
657
-
658
- /**
659
- * Indicates whether to use the new exposure strategy. The new exposure strategy handles the situation where the node is covered, such as the list nested in x-viewpager-ng or x-swiper. The performance of the new exposure strategy is slightly worse than the old one, but the result is more accurate.
660
- * @defaultValue false
661
- * @Android
662
- */
663
- 'enable-new-exposure-strategy'?: boolean;
664
-
665
- /**
666
- * Allows notification to send disappear event. It is recommended to enable.
667
- * @defaultValue false
668
244
  * @Android
245
+ * @Harmony
246
+ * @PC
669
247
  */
670
- 'enable-disappear'?: boolean;
248
+ state: ListScrollState;
249
+ }
671
250
 
251
+ export interface ListSnapInfo {
672
252
  /**
673
- * Enable asynchronous strategy
674
- * @defaultValue false
675
- * @Android
253
+ * The index of the node that will be paginated to.
676
254
  * @iOS
677
- */
678
- 'enable-async-list'?: boolean;
679
-
680
- /**
681
- * Cache the size when rendering components in child nodes of List. It is only allowed to enable under asynchronous mode.
682
- * @defaultValue false
683
- * @Android
684
- */
685
- 'enable-size-cache'?: boolean;
686
-
687
- /**
688
- * The maximum scrolling speed of the list, with a value between [0,1].
689
- * @defaultValue 1.0
690
255
  * @Android
256
+ * @Harmony
691
257
  */
692
- 'max-fling-velocity-percent'?: number;
693
-
694
- /**
695
- * When scrolling down, when the number of remaining displayable child nodes at the bottom is first less than lower-threshold-item-count, a scrolltolower event is triggered. If lower-threshold-item-count is specified, lower-threshold is not effective.
696
- * @defaultValue none
697
- * @Android
698
- * @iOS
699
- */
700
- 'lower-threshold-item-count'?: number;
701
-
258
+ position: number;
702
259
  /**
703
- * When scrolling up, when the number of remaining displayable child nodes at the top is first less than upper-threshold-item-count, a scrolltoupper event is triggered. If upper-threshold-item-count is specified, upper-threshold is not effective.
704
- * @defaultValue none
705
- * @Android
260
+ * Current scrolling left offset, in px.
706
261
  * @iOS
707
- */
708
- 'upper-threshold-item-count'?: number;
709
-
710
- /**
711
- * The property to control whether to update sticky item for diff. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
712
- * @defaultValue false
713
262
  * @Android
714
- * @iOS
263
+ * @Harmony
715
264
  */
716
- 'experimental-update-sticky-for-diff'?: boolean;
717
-
265
+ currentScrollLeft: number;
718
266
  /**
719
- * During a single sliding process, when the upper_distance is first smaller than the value specified by upper-threshold, a scrolltoupper event is triggered. When upper_distance is already smaller than the value specified by upper-threshold, the scrolltoupper event will no longer be triggered.
720
- * @defaultValue 50
721
- * @Android
267
+ * Current scrolling top offset, in px.
722
268
  * @iOS
723
- */
724
- 'upper-threshold'?: number;
725
-
726
- /**
727
- * During a single sliding process, when the lower_distance is first smaller than the value specified by lower-threshold, a scrolltolower event is triggered. When lower_distance is already smaller than the value specified by lower-threshold, the scrolltolower event will no longer be triggered.
728
- * @defaultValue 50
729
269
  * @Android
730
- * @iOS
270
+ * @Harmony
731
271
  */
732
- 'lower-threshold'?: number;
733
-
272
+ currentScrollTop: number;
734
273
  /**
735
- * Control whether the 'attachedCells' is included in the scroll event callback parameters.
736
- * @defaultValue false
737
- * @Android
274
+ * Snap scrolling left offset, in px.
738
275
  * @iOS
739
- */
740
- 'needs-visible-cells'?: boolean;
741
-
742
- /**
743
- * Control whether the list recycle available items before layout, so list can reuse these items in this layout pass. By default, the list will recycle all items after layout.
744
- * @defaultValue false
745
276
  * @Android
746
- * @iOS
747
277
  * @Harmony
748
- */
749
- 'experimental-recycle-available-item-before-layout'?: boolean;
750
-
751
- /**
752
- * Control whether the 'attachedCells' is included in the scroll event callback parameters on native list.
753
- * @defaultValue false
754
- * @Android
755
- * @iOS
756
- * @H
757
- */
758
- 'need-visible-item-info'?: boolean;
759
-
760
- /**
761
- * Specify the callback frequency of the scroll event by passing in a value, which specifies how many milliseconds (ms) <list> will call the scroll callback event during scrolling.
762
- * @defaultValue 200
763
- * @Android
764
- * @iOS
765
- */
766
- 'scroll-event-throttle'?: number;
767
-
278
+ */
279
+ targetScrollLeft: number;
768
280
  /**
769
- * List scrolling event refactoring switch. It is recommended to enable it.
770
- * @defaultValue false
281
+ * Snap scrolling top offset, in px.
771
282
  * @iOS
283
+ * @Android
284
+ * @Harmony
772
285
  */
773
- 'ios-scroll-emitter-helper'?: boolean;
286
+ targetScrollTop: number;
287
+ }
774
288
 
289
+ export interface ListLayoutCompleteInfo {
775
290
  /**
776
- * Solve the problem of inaccurate sliding distance in the list scrolling event callback. It is recommended to enable it.
777
- * @defaultValue false
291
+ * Connected to a setState.
292
+ * @defaultValue -1
293
+ * @iOS
778
294
  * @Android
295
+ * @Harmony
296
+ * @PC
779
297
  */
780
- 'android-new-scroll-top'?: boolean;
298
+ 'layout-id'?: number;
781
299
 
782
300
  /**
783
- * Allow frontend code to specify the automatic positioning of the list after rendering, only valid for single columns.
784
- * @defaultValue 0
785
- * @Android
301
+ * The diffResult of current layout change. If this diffResult is undefined, it means that the layout is triggered by a list-item update.
786
302
  * @iOS
787
- */
788
- 'initial-scroll-index'?: number;
303
+ * @Android
304
+ * @Harmony
305
+ * @PC
306
+ */
307
+ diffResult?: {
308
+ insertions: number[];
309
+ removals: number[];
310
+ // eslint-disable-next-line
311
+ move_from: number[];
312
+ // eslint-disable-next-line
313
+ move_to: number[];
314
+ // eslint-disable-next-line
315
+ update_from: number[];
316
+ // eslint-disable-next-line
317
+ update_to: number[];
318
+ };
789
319
 
790
320
  /**
791
- * The difference of double-sided page turning effect: On Android, it controls scrolling one child node at a time; on iOS, it controls scrolling one list viewport distance at a time.
792
- * @defaultValue false
793
- * @Android
321
+ * Cell info of the list before layout.
794
322
  * @iOS
795
- * @experimental
323
+ * @Android
324
+ * @Harmony
325
+ * @PC
796
326
  */
797
- 'paging-enabled'?: boolean;
327
+ visibleItemBeforeUpdate?: ListItemInfo[];
798
328
 
799
329
  /**
800
- * Enable the paging effect, and after each scroll, the list-item will stop at a specified position. For list-type:single only/
801
- * @defaultValue undefined
802
- * @Android
330
+ * Cell info of the list after layout.
803
331
  * @iOS
804
- * @experimental
332
+ * @Android
333
+ * @Harmony
334
+ * @PC
805
335
  */
806
- 'item-snap'?: ListItemSnapAlignment;
336
+ visibleItemAfterUpdate?: ListItemInfo[];
807
337
 
808
338
  /**
809
- * Notify the parent view not to intercept the event. Enable this when the list is in a client container (RecyclerView) and needs to be scrollable.
810
- * @defaultValue false
339
+ * The scroll info after layout.
340
+ * @iOS
811
341
  * @Android
342
+ * @Harmony
343
+ * @PC
812
344
  */
813
- 'android-preference-consume-gesture'?: boolean;
345
+ scrollInfo: ListScrollInfo;
346
+ }
814
347
 
815
- /** scroll-view and list can be nested for scrolling. The scrolling of the child view triggered by a single gesture can drive the scrolling of the parent view when the inertial scrolling touches the edge.
816
- * @defaultValue false
817
- * @iOS
818
- */
819
- 'enable-nested-scroll'?: boolean;
348
+ export interface ListScrollEvent extends BaseEvent<'scroll', ListScrollInfo> {}
820
349
 
350
+ export interface ListScrollToLowerEvent extends BaseEvent<'scrolltolower', ListScrollInfo> {}
821
351
 
822
- /**
823
- * NestedScrollOptions for scrollForward
824
- * @since 3.0
825
- * @H
826
- */
827
- 'temporary-nested-scroll-forward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel';
352
+ export interface ListScrollToUpperEvent extends BaseEvent<'scrolltoupper', ListScrollInfo> {}
828
353
 
829
- /**
830
- * NestedScrollOptions for scrollBackward
831
- * @since 3.0
832
- * @H
833
- */
834
- 'temporary-nested-scroll-backward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel' ;
354
+ export interface ListScrollStateChangeEvent extends BaseEvent<'scrollstatechange', ListScrollStateInfo> {}
355
+
356
+ export interface ListSnapEvent extends BaseEvent<'snap', ListSnapInfo> {}
835
357
 
358
+ export interface ListLayoutCompleteEvent extends BaseEvent<'layoutcomplete', ListLayoutCompleteInfo> {}
359
+
360
+ export interface ListItemSnapAlignment {
836
361
  /**
837
- * Preload count.
838
- * @defaultValue 0
362
+ * Paging factor, 0.0 means align to the top, while 1.0 means align to the bottom.
839
363
  * @Android
840
364
  * @iOS
841
- * @experimental
365
+ * @Harmony
842
366
  */
843
- 'preload-buffer-count'?: number;
367
+ factor: number;
844
368
 
845
369
  /**
846
- * Whether to enable the self-preloading strategy of the list system.
847
- * @defaultValue 0
370
+ * In addition to the parameter of factor, an offset for alignment can be set, in px.
848
371
  * @Android
849
- * @experimental
850
- */
851
- 'android-enable-item-prefetch'?: boolean;
852
-
853
- /**
854
- * Determine whether the list is laid out from the top or from the bottom.
855
- * @defaultValue 'fromBegin'
856
372
  * @iOS
857
- * @experimental
373
+ * @Harmony
858
374
  */
859
- 'anchor-priority'?: 'fromBegin' | 'fromEnd';
375
+ offset: number;
376
+ }
860
377
 
378
+ /**
379
+ * list. A list does not support adaptive height and the 'height' property must be specified for the <list> tag in order to set its height.
380
+ */
381
+ export interface ListProps extends StandardProps {
861
382
  /**
862
- * When all nodes on the screen are deleted, find the anchor point outside the top/bottom area.
863
- * @defaultValue 'toTop'
383
+ * Sets the scrolling direction and layout direction.
384
+ * @defaultValue 'vertical'
864
385
  * @iOS
865
- * @experimental
386
+ * @Android
387
+ * @Harmony
388
+ * @PC
866
389
  */
867
- 'delete-regress-policy'?: 'toTop' | 'toBottom';
390
+ 'scroll-orientation'?: 'vertical' | 'horizontal';
868
391
 
869
392
  /**
870
- * Using 'outside' can make the inserted element visible at the edge of the screen, and using 'inside' can make the inserted element invisible at the edge of the screen.
871
- * @defaultValue 'inside'
393
+ * The number of columns or rows for the list, and only effective when list-type is 'flow' or 'waterfall'.
394
+ * @defaultValue 1
395
+ * @Android
872
396
  * @iOS
873
- * @experimental
397
+ * @Harmony
398
+ * @PC
874
399
  */
875
- 'insert-anchor-mode'?: 'outside' | 'inside';
400
+ 'span-count'?: number;
876
401
 
877
402
  /**
878
- * "The dot element is positioned at the fully visible position (show) or at the point just invisible (hide), and no adjustment is made by default."
879
- * @defaultValue 'noAdjustment'
403
+ * layout type of the list
404
+ * @defaultValue 'single'
405
+ * @Android
880
406
  * @iOS
881
- * @experimental
407
+ * @Harmony
408
+ * @PC
882
409
  */
883
- 'anchor-visibility'?: 'noAdjustment' | 'show' | 'hide';
410
+ 'list-type'?: 'single' | 'flow' | 'waterfall';
884
411
 
885
412
  /**
886
- * 'anchor-align-to-bottom' will keep the bottom of the anchor at the same distance from the visible area, while 'anchor-align-to-top' will keep the top of the anchor at the same distance from the visible area.
887
- * @defaultValue 'toTop'
413
+ * Whether to allow scrolling for a list.
414
+ * @defaultValue true
415
+ * @Android
888
416
  * @iOS
889
- * @experimental
417
+ * @Harmony
418
+ * @PC
890
419
  */
891
- 'anchor-align'?: 'toBottom' | 'toTop';
420
+ 'enable-scroll'?: boolean;
892
421
 
893
422
  /**
894
- * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
895
- * @defaultValue false
896
- * @deprecated 2.17
897
- * @iOS
423
+ * Indicates whether list can achieve nested scrolling with other scrollable containers. When enabled, the inner container scrolls first, followed by the outer container.
424
+ * @defaultValue false
898
425
  * @Android
426
+ * @iOS
427
+ * @Harmony
428
+ * @PC
899
429
  */
900
- 'internal-cell-appear-notification'?: boolean;
430
+ 'enable-nested-scroll'?: boolean;
901
431
 
902
432
  /**
903
- * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
904
- * @defaultValue false
905
- * @deprecated 2.17
906
- * @iOS
433
+ * Declared on the list to control whether the list as a whole is allowed to be sticky at the top or bottom.
434
+ * @defaultValue false
907
435
  * @Android
436
+ * @iOS
437
+ * @Harmony
438
+ * @PC
908
439
  */
909
- 'internal-cell-disappear-notification'?: boolean;
440
+ sticky?: boolean;
910
441
 
911
442
  /**
912
- * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
913
- * @defaultValue false
914
- * @deprecated 2.17
915
- * @iOS
443
+ * The offset distance from the top or bottom of list for sticky positioning, in px.
444
+ * @defaultValue 0
916
445
  * @Android
446
+ * @iOS
447
+ * @Harmony
448
+ * @PC
917
449
  */
918
- 'internal-cell-prepare-for-reuse-notification'?: boolean;
450
+ 'sticky-offset'?: number;
919
451
 
920
452
  /**
921
- * The lifecycle of element layer reuse. It solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item. It replaces internal-cell-appear-notification, internal-cell-disappear-notification, and internal-cell-prepare-for-reuse-notification.
922
- * @defaultValue false
923
- * @since 2.17
453
+ * Control whether list should produce bounces effect when scrolling past its content boundaries.
454
+ * @defaultValue true
924
455
  * @iOS
925
- * @Android
456
+ * @Harmony
457
+ * @PC
926
458
  */
927
- 'should-request-state-restore'?: boolean;
459
+ bounces?: boolean;
928
460
 
929
461
  /**
930
- * After the layout of the list is completed, preload the vdom of the remaining nodes in advance to improve the scrolling frame rate of the subsequent list.
931
- * @defaultValue false
932
- * @experimental
933
- * @iOS
462
+ * Specifies the node position to which list automatically scrolls after rendering.
463
+ * @defaultValue 0
934
464
  * @Android
935
- * @since 2.17
465
+ * @iOS
466
+ * @Harmony
467
+ * @PC
936
468
  */
937
- 'experimental-enable-preload-section'?: boolean;
469
+ 'initial-scroll-index'?: number;
938
470
 
939
471
  /**
940
- * Since RecyclerView is a collection ViewGroup that includes virtual children (items that are in the Adapter but not visible in the UI), it employs a more involved focus search strategy that differs from other ViewGroups, which may lead to unexpected scroll behavior. This property is used to control whether the focus search strategy is enabled, and if set to false, the focus search strategy of RecyclerView will be disabled and directly return the current focused view in focusSearch method.
941
- * @defaultValue true
472
+ * Controls whether the scroll event callback parameters include the position information of the currently rendering node.
473
+ * @defaultValue false
942
474
  * @Android
943
- * @since 2.17
475
+ * @iOS
476
+ * @Harmony
477
+ * @PC
944
478
  */
945
- 'android-enable-focus-search'?: boolean;
479
+ 'need-visible-item-info'?: boolean;
946
480
 
947
481
  /**
948
- * Warning: It is not recommended to enable it in the production environment. Adjust the level of detail for bindlistdebugevent, with 0 meaning no output, 1 meaning outputting warnings, 2 meaning outputting information, and 3 meaning outputting detailed debug information.
949
- * @defaultValue 2
950
- * @iOS
482
+ * When scrolling down, when the number of remaining displayable child nodes at the bottom is first less than lower-threshold-item-count, a scrolltolower event is triggered. If lower-threshold-item-count is specified, lower-threshold is not effective.
483
+ * @defaultValue 0
951
484
  * @Android
952
- * @since 2.18
485
+ * @iOS
486
+ * @Harmony
487
+ * @PC
953
488
  */
954
- 'list-debug-info-level'?: number;
489
+ 'lower-threshold-item-count'?: number;
955
490
 
956
491
  /**
957
- * The strategy of list batch rendering in Fiber arch. The value of this property can be set to the value of Enum BatchRenderStrategy.
958
- * @defaultValue BatchRenderStrategy.DEFAULT
959
- * @iOS
492
+ * When scrolling up, when the number of remaining displayable child nodes at the top is first less than upper-threshold-item-count, a scrolltoupper event is triggered. If upper-threshold-item-count is specified, upper-threshold is not effective.
493
+ * @defaultValue 0
960
494
  * @Android
961
- * @since 3.1
495
+ * @iOS
496
+ * @Harmony
497
+ * @PC
962
498
  */
963
- 'experimental-batch-render-strategy'?: BatchRenderStrategy;
499
+ 'upper-threshold-item-count'?: number;
964
500
 
965
501
  /**
966
- * Scroll event.
502
+ * Specify the callback frequency of the scroll event by passing in a value, which specifies how many milliseconds (ms) list will call the scroll callback event during scrolling.
503
+ * @defaultValue 200
967
504
  * @Android
968
505
  * @iOS
506
+ * @Harmony
507
+ * @PC
969
508
  */
970
- bindscroll?: EventHandler<ListScrollEvent>;
509
+ 'scroll-event-throttle'?: number;
971
510
 
972
511
  /**
973
- * Callback function for scrolling to the top.
512
+ * Enable the paging effect, and after each scroll, the list-item will stop at a specified position. For list-type:single only.
974
513
  * @Android
975
514
  * @iOS
515
+ * @Harmony
976
516
  */
977
- bindscrolltoupper?: EventHandler<ListScrollToUpperEvent>;
517
+ 'item-snap'?: ListItemSnapAlignment;
978
518
 
979
519
  /**
980
- * Callback function for scrolling to the bottom.
520
+ * Controls whether the layoutcomplete event includes the node layout information before and after this layout, and the list Diff information that triggered this layout, and the current list scroll state information.
521
+ * @defaultValue false
981
522
  * @Android
982
523
  * @iOS
524
+ * @Harmony
525
+ * @PC
983
526
  */
984
- bindscrolltolower?: EventHandler<ListScrollToLowerEvent>;
527
+ 'need-layout-complete-info'?: boolean;
985
528
 
986
529
  /**
987
- * This callback function is triggered when the scrolling state of the list changes.
530
+ * Used to mark the unique identifier for this data source update, which will be returned in the layoutcomplete event callback.
531
+ * @defaultValue -1
988
532
  * @Android
989
533
  * @iOS
534
+ * @Harmony
535
+ * @PC
990
536
  */
991
- bindscrollstatechange?: EventHandler<ListScrollStateChangeEvent>;
537
+ 'layout-id'?: number;
538
+
992
539
  /**
993
- * This callback function will be triggered when the first screen of the list has finished rendering. On iOS, this callback function will be triggered when list has an update.
540
+ * This attribute controls the number of nodes outside list that are preloaded.
541
+ * @defaultValue 0
994
542
  * @Android
995
543
  * @iOS
544
+ * @Harmony
545
+ * @PC
996
546
  */
997
- bindlayoutcomplete?: EventHandler<ListLayoutFinishEvent> | EventHandler<LayoutCompleteEvent>;
547
+ 'preload-buffer-count'?: number;
548
+
998
549
  /**
999
- * Warning: It is not recommended to enable it in the production environment. Output debug information for the list.
1000
- * @since 2.18
1001
- * @Android
550
+ * Whether to display the scroll bar of the list, with false on Harmony platform and true on other platforms.
551
+ * @defaultValue undefined
1002
552
  * @iOS
553
+ * @Harmony
554
+ * @PC
1003
555
  */
1004
- bindlistdebugevent?: EventHandler<ListDebugInfoEvent>;
556
+ 'scroll-bar-enable'?: boolean;
557
+
1005
558
  /**
1006
- * scrollview scrolls to upper edge
1007
- * @since 3.0
1008
- * @iOS
559
+ * The property to control whether recycle sticky item. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
560
+ * @defaultValue false
1009
561
  * @Android
1010
- * @H
562
+ * @iOS
563
+ * @Harmony
564
+ * @PC
1011
565
  */
1012
- bindscrolltoupperedge?: EventHandler<ListScrollToUpperEdgeEvent>;
566
+ 'experimental-recycle-sticky-item'?: boolean;
1013
567
 
1014
568
  /**
1015
- * scrollview scrolls to lower edge
1016
- * @since 3.0
1017
- * @iOS
1018
- * @Android
1019
- * @H
569
+ * When the content size of a component is smaller than the component itself, decide whether to enable scrolling.
570
+ * @defaultValue false
571
+ * @Harmony
572
+ * @since 3.4
1020
573
  */
1021
- bindscrolltoloweredge?: EventHandler<ListScrollToLowerEdgeEvent>;
574
+ 'harmony-scroll-edge-effect'?: boolean;
1022
575
 
1023
576
  /**
1024
- * scrollview scrolls to normal position. Not at upper or lower edge
1025
- * @since 3.0
1026
- * @iOS
577
+ * Scroll event.
1027
578
  * @Android
1028
- * @H
579
+ * @iOS
580
+ * @Harmony
581
+ * @PC
1029
582
  */
1030
- bindscrolltonormalstate?: EventHandler<ListScrollToNormalStateEvent>;
1031
- }
583
+ bindscroll?: EventHandler<ListScrollEvent>;
1032
584
 
1033
- export interface ListItemProps extends StandardProps {
1034
585
  /**
1035
- * sticky top effect. Not compatible with flatten.
1036
- * @defaultValue false
586
+ * Callback function for scrolling to the top.
1037
587
  * @Android
1038
588
  * @iOS
589
+ * @Harmony
590
+ * @PC
1039
591
  */
1040
- 'sticky-top'?: boolean;
592
+ bindscrolltoupper?: EventHandler<ListScrollToUpperEvent>;
1041
593
 
1042
594
  /**
1043
- * sticky bottom effect. Not compatible with flatten.
1044
- * @defaultValue false
595
+ * Callback function for scrolling to the bottom.
1045
596
  * @Android
1046
597
  * @iOS
598
+ * @Harmony
599
+ * @PC
1047
600
  */
1048
- 'sticky-bottom'?: boolean;
601
+ bindscrolltolower?: EventHandler<ListScrollToLowerEvent>;
1049
602
 
1050
603
  /**
1051
- * Adding the `full-span` attribute to `<list-item/>` will make it occupy a single line. You need to configure {@link ListProps."list-type" | list-type} correctly to make the list enter a multi-column layout for this to work.
1052
- * @defaultValue undefined
604
+ * This callback function is triggered when the scrolling state of the list changes.
1053
605
  * @Android
1054
606
  * @iOS
607
+ * @Harmony
608
+ * @PC
1055
609
  */
1056
- 'full-span'?: boolean;
610
+ bindscrollstatechange?: EventHandler<ListScrollStateChangeEvent>;
1057
611
 
1058
612
  /**
1059
- * Preset height to control the placeholder height of the view while the list component has not finished rendering. The more accurately it is set, the less flickering the list will have.
1060
- * @defaultValue undefined
613
+ * This callback function will be triggered when the first screen of the list has finished rendering. On iOS, this callback function will be triggered when list has an update.
1061
614
  * @Android
1062
615
  * @iOS
1063
- * @deprecated For Lynx>=3.1, use {@link estimated-main-axis-size-px} instead
616
+ * @Harmony
617
+ * @PC
1064
618
  */
1065
- 'estimated-height-px'?: number;
619
+ bindlayoutcomplete?: EventHandler<ListLayoutCompleteEvent>;
1066
620
 
1067
621
  /**
1068
- * Preset height to control the placeholder height (in physical pixels) of the view while the list component has not finished rendering. The more accurately it is set, the less flickering the list will have.
1069
- * @defaultValue undefined
622
+ * Snap callback
623
+ * @since 2.16
1070
624
  * @Android
1071
625
  * @iOS
1072
- * @deprecated For Lynx>=3.1, use {@link estimated-main-axis-size-px} instead
626
+ * @Harmony
1073
627
  */
1074
- 'estimated-height'?: number;
628
+ bindsnap?: EventHandler<ListSnapEvent>;
629
+ }
1075
630
 
631
+ export interface ScrollToPositionParams {
1076
632
  /**
1077
- * Preset size in main scroll axis to control the placeholder size of the view while the list component has not finished rendering. The more accurately it is set, the less flickering the list will have.
1078
- * @since 3.1
1079
- * @defaultValue undefined
633
+ * Specify the index of the node to scroll to, with a value range of [0, itemCount).
1080
634
  * @Android
1081
635
  * @iOS
636
+ * @Harmony
637
+ * @PC
1082
638
  */
1083
- 'estimated-main-axis-size-px'?: number;
639
+ index: number;
1084
640
 
1085
641
  /**
1086
- * Snap callback
642
+ * Specify the alignment method when scrolling to a target position.
643
+ * "bottom": Scroll to make the node fully visible in the list and align the bottom of the node with the bottom of the list.
644
+ * "top": Scroll to make the node fully visible in the list and align the top of the node with the top of the list.
645
+ * "middle": Scroll to make the node fully visible in the list and align the center of the node with the center of the list. This is only supported in LynxSDK 2.12 and above.
646
+ * @defaultValue 'top'
1087
647
  * @Android
1088
648
  * @iOS
649
+ * @Harmony
650
+ * @PC
1089
651
  */
1090
- bindsnap?: EventHandler<ListEvent<'snap'>>;
652
+ alignTo?: 'bottom' | 'top' | 'middle';
1091
653
 
1092
654
  /**
655
+ * Align the node with alignTo, and then move the node downward by a length of offset.
656
+ * @defaultValue 0
1093
657
  * @Android
1094
658
  * @iOS
659
+ * @Harmony
660
+ * @PC
1095
661
  */
1096
- 'item-key': string;
662
+ offset?: number;
1097
663
 
1098
664
  /**
1099
- * Control whether the list-item can be recycled. If set to false, the list-item will not be recycled after being scrolled off the screen, and do not need to be re-rendered when they come back on the screen. The default value is true.
1100
- * @since 3.4
1101
- * @defaultValue true
665
+ * Enable scroll animation during scroll.
666
+ * @defaultValue false
1102
667
  * @Android
1103
668
  * @iOS
1104
669
  * @Harmony
670
+ * @PC
1105
671
  */
1106
- recyclable?: boolean | undefined;
1107
-
1108
- bindnodeappear?: EventHandler<AppearanceEvent>;
1109
- bindnodedisappear?: EventHandler<AppearanceEvent>;
672
+ smooth?: boolean;
1110
673
  }
1111
674
 
1112
- export interface ListRowProps extends ListItemProps {}
675
+ /**
676
+ * Scroll the list to the specified position.
677
+ * @Android
678
+ * @iOS
679
+ * @Harmony
680
+ * @PC
681
+ */
682
+ export interface ScrollToPositionMethod extends BaseMethod {
683
+ method: 'scrollToPosition';
684
+
685
+ params: ScrollToPositionParams;
686
+ }
1113
687
 
1114
688
  /**
1115
- * Automatic scrolling
689
+ * Automatic scrolling.
1116
690
  * @Android
1117
691
  * @iOS
692
+ * @Harmony
1118
693
  */
1119
694
  export interface AutoScrollMethod extends BaseMethod {
1120
695
  method: 'autoScroll';
1121
696
  params: {
1122
697
  /**
1123
- * The distance of each second's scrolling, which supports positive and negative values. The unit of distance can be "px", "rpx", "ppx", or null (for iOS, the value must be greater than 1/screen.scale px).
698
+ * Start/stop automatic scrolling.
699
+ * @defaultValue false
1124
700
  * @Android
1125
701
  * @iOS
702
+ * @Harmony
1126
703
  */
1127
- rate: string;
704
+ start?: boolean;
705
+
1128
706
  /**
1129
- * Start/stop automatic scrolling.
1130
- * @defaultValue false
707
+ * The distance of each second's scrolling, which supports positive and negative values. The unit of distance can be "px", "rpx", "ppx", or null (for iOS, the value must be greater than 1/screen.scale px).
1131
708
  * @Android
1132
709
  * @iOS
710
+ * @Harmony
1133
711
  */
1134
- start: boolean;
712
+ rate: string;
713
+
1135
714
  /**
1136
715
  * Whether to stop automatically when sliding to the bottom.
1137
716
  * @defaultValue true
1138
717
  * @Android
1139
718
  * @iOS
719
+ * @Harmony
1140
720
  */
1141
- autoStop: boolean;
721
+ autoStop?: boolean;
1142
722
  };
1143
723
  }
1144
724
 
@@ -1146,93 +726,33 @@ export interface AutoScrollMethod extends BaseMethod {
1146
726
  * Get the info of the currently displayed list item.
1147
727
  * @Android
1148
728
  * @iOS
729
+ * @Harmony
730
+ * @PC
1149
731
  */
1150
732
  export interface GetVisibleCellsMethod extends BaseMethod {
1151
733
  method: 'getVisibleCells';
1152
734
  }
1153
735
 
1154
736
  /**
1155
- * Get the index of the currently displayed list item.
1156
- * @Android
1157
- */
1158
- export interface GetVisibleItemsPositionsMethod extends BaseMethod {
1159
- method: 'getVisibleItemsPositions';
1160
- }
1161
-
1162
- /**
1163
- * Remove current sticky view.
1164
- * @Android
1165
- */
1166
- export interface RemoveStickyViewMethod extends BaseMethod {
1167
- method: 'removeStickyView';
1168
- }
1169
-
1170
- /**
1171
- * Init the cache of the list.
1172
- * @Android
1173
- */
1174
- export interface InitCacheMethod extends BaseMethod {
1175
- method: 'initCache';
1176
- }
1177
-
1178
- /**
1179
- * Scroll the list to the specified position.
737
+ * Scroll by specified offset
1180
738
  * @Android
1181
739
  * @iOS
740
+ * @Harmony
741
+ * @PC
1182
742
  */
1183
- export interface ScrollToPositionMethod extends BaseMethod {
1184
- method: 'scrollToPosition';
1185
- params: {
1186
- /**
1187
- * From version 2.17 and above, it is recommended to use 'index' instead. Specify the index of the node to scroll to, with a value range of [0, itemCount).
1188
- * @deprecated 2.17
1189
- * @Android
1190
- * @iOS
1191
- */
1192
- position: number;
1193
-
1194
- /**
1195
- * Specify the index of the node to scroll to, with a value range of [0, itemCount).
1196
- * @since 2.17
1197
- * @Android
1198
- * @iOS
1199
- */
1200
- index: number;
1201
-
1202
- /**
1203
- * Specify the alignment method when scrolling to a target position.
1204
- * "none": Scroll to make the node fully visible in the list. If the node is above the visible range of the list, it will scroll to align the top of the node with the top of the list. If the node is below the visible range of the list, it will scroll to align the bottom of the node with the bottom of the list. If the node is within the visible range of the list, no movement will occur.
1205
- * "bottom": Scroll to make the node fully visible in the list and align the bottom of the node with the bottom of the list.
1206
- * "top": Scroll to make the node fully visible in the list and align the top of the node with the top of the list.
1207
- * "middle": Scroll to make the node fully visible in the list and align the center of the node with the center of the list. This is only supported in LynxSDK 2.12 and above.
1208
- * @defaultValue none
1209
- * @Android
1210
- * @iOS
1211
- */
1212
- alignTo?: 'none' | 'bottom' | 'top' | 'middle';
1213
-
1214
- /**
1215
- * Align the node with alignTo, and then move the node downward by a length of offset.
1216
- * @Android
1217
- * @iOS
1218
- */
1219
- offset?: number;
743
+ export interface ScrollByMethod extends BaseMethod {
744
+ method: 'scrollBy';
1220
745
 
746
+ params: {
1221
747
  /**
1222
- * Enable scroll animation during scroll.
1223
- * @defaultValue false
748
+ * Offset to scroll, in px.
1224
749
  * @Android
1225
750
  * @iOS
751
+ * @Harmony
752
+ * @PC
1226
753
  */
1227
- smooth?: boolean;
1228
-
1229
- /**
1230
- * When enabled, it uses the refactored logic which helps to solve some existing bugs. It is recommended to enable it.
1231
- * @defaultValue false
1232
- * @iOS
1233
- */
1234
- useScroller?: boolean;
754
+ offset: number;
1235
755
  };
1236
756
  }
1237
757
 
1238
- export type ListUIMethods = ScrollToPositionMethod | AutoScrollMethod | GetVisibleCellsMethod | GetVisibleItemsPositionsMethod | RemoveStickyViewMethod | InitCacheMethod;
758
+ export type ListUIMethods = ScrollToPositionMethod | AutoScrollMethod | GetVisibleCellsMethod | ScrollByMethod;