@lynx-js/types 3.4.3 → 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,971 +1,584 @@
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,
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.
14
+ * @Android
15
+ * @iOS
16
+ * @Harmony
17
+ * @PC
18
+ */
19
+ export enum ListScrollState {
20
+ SCROLL_STATE_STOP = 1,
21
+ SCROLL_STATE_DRAGGING = 2,
22
+ SCROLL_STATE_DECELERATE = 3,
23
+ SCROLL_STATE_ANIMATION = 4,
12
24
  }
13
25
 
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.
26
+ /**
27
+ * The source of the scroll event.
19
28
  * @Android
20
29
  * @iOS
30
+ * @Harmony
31
+ * @PC
21
32
  */
22
- export enum BatchRenderStrategy {
23
- DEFAULT = 0,
24
- BATCH_RENDER = 1,
25
- ASYNC_RESOLVE_PROPERTY = 2,
26
- ASYNC_RESOLVE_PROPERTY_AND_ELEMENT_TREE = 3
33
+ export enum ListEventSource {
34
+ DIFF = 0,
35
+ LAYOUT = 1,
36
+ SCROLL = 2,
27
37
  }
28
38
 
29
- export interface ListScrollInfo {
39
+ export interface ListAttachedCell {
30
40
  /**
31
- * scroll left from start
32
- * @Android
41
+ * id of list item
33
42
  * @iOS
34
- */
35
- scrollLeft: number;
36
- /**
37
- * scroll top from start
38
43
  * @Android
39
- * @iOS
44
+ * @Harmony
45
+ * @PC
40
46
  */
41
- scrollTop: number;
47
+ id: string;
42
48
  /**
43
- * scroll content width
44
- * @Android
49
+ * item-key of list item
45
50
  * @iOS
46
- */
47
- scrollWidth: number;
48
- /**
49
- * scroll content height
50
51
  * @Android
51
- * @iOS
52
+ * @Harmony
53
+ * @PC
52
54
  */
53
- scrollHeight: number;
55
+ itemKey: string;
54
56
  /**
55
- * list width
56
- * @Android
57
+ * index of list item
57
58
  * @iOS
58
- */
59
- listWidth: number;
60
- /**
61
- * list height
62
59
  * @Android
63
- * @iOS
60
+ * @Harmony
61
+ * @PC
64
62
  */
65
- listHeight: number;
63
+ index: number;
66
64
  /**
67
- * X-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
68
- * @Android
65
+ * left position of list item relative to list, in px
69
66
  * @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
67
  * @Android
75
- * @iOS
68
+ * @Harmony
69
+ * @PC
76
70
  */
77
- deltaY: number;
71
+ left: number;
78
72
  /**
79
- * Source of the event.
80
- * @Android
73
+ * top position of list item relative to list, in px
81
74
  * @iOS
75
+ * @Android
76
+ * @Harmony
77
+ * @PC
82
78
  */
83
- eventSource: ListEventSource;
79
+ top: number;
84
80
  /**
85
- * attached cells
81
+ * right position of list item relative to list, in px
86
82
  * @iOS
87
83
  * @Android
84
+ * @Harmony
85
+ * @PC
88
86
  */
89
- attachedCells: ListAttachedCell[];
90
- }
91
-
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 {
87
+ right: number;
100
88
  /**
101
- * Paging factor, 0.0 means align to the top, while 1.0 means align to the bottom.
102
- * @Android
89
+ * bottom position of list item relative to list, in px
103
90
  * @iOS
104
- */
105
- factor: number;
106
- /**
107
- * In addition to the parameter of factor, an offset for alignment can be set, in px.
108
91
  * @Android
109
- * @iOS
92
+ * @Harmony
93
+ * @PC
110
94
  */
111
- offset: number;
95
+ bottom: number;
112
96
  }
113
97
 
114
- export interface ListItemInfo {
115
- /**
116
- * Height of the item, in px.
117
- * @Android
118
- * @iOS
119
- * @H
120
- */
121
- height: number;
122
- /**
123
- * Width of the item, in px.
124
- * @Android
125
- * @iOS
126
- * @H
127
- */
128
- width: number;
98
+ export interface ListScrollInfo {
129
99
  /**
130
- * ItemKey of the list-item.
100
+ * Horizontal scroll offset since the last scroll, in px.
131
101
  * @Android
132
102
  * @iOS
133
- * @H
103
+ * @Harmony
104
+ * @PC
134
105
  */
135
- itemKey: string;
106
+ deltaX: number;
136
107
  /**
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.
108
+ * Vertical scroll offset since the last scroll, in px.
138
109
  * @Android
139
110
  * @iOS
140
- * @H
111
+ * @Harmony
112
+ * @PC
141
113
  */
142
- isBinding: boolean;
114
+ deltaY: number;
143
115
  /**
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.
116
+ * Current horizontal scroll offset, in px.
145
117
  * @Android
146
118
  * @iOS
147
- * @H
119
+ * @Harmony
120
+ * @PC
148
121
  */
149
- originX: number;
122
+ scrollLeft: number;
150
123
  /**
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.
124
+ * Current vertical scroll offset, in px.
152
125
  * @Android
153
126
  * @iOS
154
- * @H
127
+ * @Harmony
128
+ * @PC
155
129
  */
156
- originY: number;
130
+ scrollTop: number;
157
131
  /**
158
- * Show if the list-item is currently being updated in this layout.
132
+ * Current content area width, in px.
159
133
  * @Android
160
134
  * @iOS
161
- * @H
135
+ * @Harmony
136
+ * @PC
162
137
  */
163
- updated: boolean;
164
- }
165
-
166
- export interface ListAttachedCell {
138
+ scrollWidth: number;
167
139
  /**
168
- * id
169
- * @iOS
140
+ * Current content area height, in px.
170
141
  * @Android
171
- */
172
- id: string;
173
- /**
174
- * bottom
175
142
  * @iOS
176
- * @Android
143
+ * @Harmony
144
+ * @PC
177
145
  */
178
- bottom: number;
146
+ scrollHeight: number;
179
147
  /**
180
- * top
181
- * @iOS
148
+ * list width, in px.
182
149
  * @Android
183
- */
184
- top: number;
185
- /**
186
- * left
187
150
  * @iOS
188
- * @Android
151
+ * @Harmony
152
+ * @PC
189
153
  */
190
- left: number;
154
+ listWidth: number;
191
155
  /**
192
- * right
193
- * @iOS
156
+ * list height, in px.
194
157
  * @Android
195
- */
196
- right: number;
197
- /**
198
- * postion
199
158
  * @iOS
200
- * @Android
159
+ * @Harmony
160
+ * @PC
201
161
  */
202
- position: number;
203
- }
204
-
205
- export interface ListDetail {
162
+ listHeight: number;
206
163
  /**
207
- * scroll top from start
208
- * @iOS
164
+ * Source of the event.
209
165
  * @Android
210
- */
211
- scrollTop: number;
212
- /**
213
- * scrolling delta at y axis
214
166
  * @iOS
215
- * @Android
167
+ * @Harmony
168
+ * @PC
216
169
  */
217
- deltaY: number;
170
+ eventSource: ListEventSource;
218
171
  /**
219
- * attached cells
172
+ * Information of the currently rendering list items.
220
173
  * @iOS
221
174
  * @Android
175
+ * @Harmony
176
+ * @PC
222
177
  */
223
178
  attachedCells: ListAttachedCell[];
224
179
  }
225
180
 
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', {}> {
181
+ export interface ListItemInfo {
302
182
  /**
303
- * Layout details
304
- * @iOS
183
+ * Height of the list item, in px.
305
184
  * @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
- * @iOS
374
- */
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
185
  * @iOS
186
+ * @Harmony
187
+ * @PC
402
188
  */
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
-
189
+ height: number;
419
190
  /**
420
- * Control whether dataSet can be used as the unique identifier. It will call RecyclerView.setHasStableIds() internally.
421
- * @defaultValue false
191
+ * Width of the list item, in px.
422
192
  * @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
193
  * @iOS
194
+ * @Harmony
195
+ * @PC
430
196
  */
431
- 'ios-forbid-single-sided-bounce'?: 'upperBounce' | 'lowerBounce' | 'none';
432
-
433
- /**
434
- * Control whether list should produce over-scroll effect when scrolling past its content boundaries.
435
- * @defaultValue false
436
- * @Android
437
- */
438
- 'over-scroll'?: boolean;
439
-
197
+ width: number;
440
198
  /**
441
- * Whether to allow scrolling for a list.
442
- * @defaultValue true
199
+ * ItemKey of the list-item.
443
200
  * @Android
444
201
  * @iOS
202
+ * @Harmony
203
+ * @PC
445
204
  */
446
- 'enable-scroll'?: boolean;
447
-
448
- /**
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
451
- * @Android
452
- */
453
- 'touch-scroll'?: boolean;
454
-
205
+ itemKey: string;
455
206
  /**
456
- * layout type of the list
457
- * @defaultValue "single"
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.
458
208
  * @Android
459
209
  * @iOS
210
+ * @Harmony
211
+ * @PC
460
212
  */
461
- 'list-type'?: 'single' | 'flow' | 'waterfall';
462
-
213
+ isBinding: boolean;
463
214
  /**
464
- * The number of columns for a list, only effective when list-type is 'flow' or 'waterfall'.
465
- * @defaultValue 0
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.
466
216
  * @Android
467
217
  * @iOS
218
+ * @Harmony
219
+ * @PC
468
220
  */
469
- 'column-count'?: number;
470
-
221
+ originX: number;
471
222
  /**
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
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.
474
224
  * @Android
475
225
  * @iOS
226
+ * @Harmony
227
+ * @PC
476
228
  */
477
- 'vertical-orientation'?: boolean;
478
-
479
- /**
480
- * Replacement of vertical-orientation
481
- * @since 3.0
482
- * @iOS
483
- * @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
-
229
+ originY: number;
495
230
  /**
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
231
+ * Show if the list-item is currently being updated in this layout.
498
232
  * @Android
499
233
  * @iOS
234
+ * @Harmony
235
+ * @PC
500
236
  */
501
- 'enable-rtl'?: boolean;
237
+ updated: boolean;
238
+ }
502
239
 
240
+ export interface ListScrollStateInfo {
503
241
  /**
504
- * The ceiling or floor effect is not compatible with flatten.
505
- * @defaultValue false
506
- * @Android
242
+ * scroll state
507
243
  * @iOS
508
- */
509
- sticky?: boolean;
510
-
511
- /**
512
- * The distance between the ceiling or floor position and the top or bottom of the list, in pixels.
513
- * @defaultValue 0
514
244
  * @Android
515
- * @iOS
245
+ * @Harmony
246
+ * @PC
516
247
  */
517
- 'sticky-offset'?: number;
248
+ state: ListScrollState;
249
+ }
518
250
 
251
+ export interface ListSnapInfo {
519
252
  /**
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
522
- * @Android
253
+ * The index of the node that will be paginated to.
523
254
  * @iOS
524
- */
525
- 'experimental-recycle-sticky-item'?: boolean;
526
-
527
- /**
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
530
255
  * @Android
531
- * @iOS
256
+ * @Harmony
532
257
  */
533
- 'sticky-buffer-count'?: number;
534
-
258
+ position: number;
535
259
  /**
536
- * When enabled, the upper or lower element will also be shifted together with the bounces effect.
537
- * @defaultValue false
260
+ * Current scrolling left offset, in px.
538
261
  * @iOS
539
- */
540
- 'sticky-with-bounces'?: boolean;
541
-
542
- /**
543
- * Rollback to the older version's sticky feature.
544
- * @defaultValue false
545
262
  * @Android
546
- * @iOS
547
- * @deprecated since 2.14
263
+ * @Harmony
548
264
  */
549
- 'use-old-sticky'?: boolean;
550
-
265
+ currentScrollLeft: number;
551
266
  /**
552
- * To solve the conflict between list and x-refresh-view
553
- * @defaultValue false
554
- * @experimental
267
+ * Current scrolling top offset, in px.
555
268
  * @iOS
556
- * @since 2.18
557
- */
558
- 'experimental-disable-filter-scroll'?: boolean;
559
-
560
- /**
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
564
269
  * @Android
565
- * @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
270
+ * @Harmony
576
271
  */
577
- 'experimental-ios-gesture-frequency-increasing'?: boolean;
578
-
272
+ currentScrollTop: number;
579
273
  /**
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
274
+ * Snap scrolling left offset, in px.
582
275
  * @iOS
583
276
  * @Android
584
- * @since 3.1
277
+ * @Harmony
585
278
  */
586
- 'force-can-scroll'?: boolean;
587
-
279
+ targetScrollLeft: number;
588
280
  /**
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
281
+ * Snap scrolling top offset, in px.
591
282
  * @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
283
+ * @Android
284
+ * @Harmony
601
285
  */
602
- 'ios-enable-align-height'?: boolean;
286
+ targetScrollTop: number;
287
+ }
603
288
 
289
+ export interface ListLayoutCompleteInfo {
604
290
  /**
605
- * Deprecated
606
- * @defaultValue true
291
+ * Connected to a setState.
292
+ * @defaultValue -1
607
293
  * @iOS
608
- * @deprecated since 2.10
294
+ * @Android
295
+ * @Harmony
296
+ * @PC
609
297
  */
610
- 'ios-no-recursive-layout'?: boolean;
298
+ 'layout-id'?: number;
611
299
 
612
300
  /**
613
- * Deprecated
614
- * @defaultValue true
301
+ * The diffResult of current layout change. If this diffResult is undefined, it means that the layout is triggered by a list-item update.
615
302
  * @iOS
616
- * @deprecated since 2.10
617
- */
618
- 'ios-force-reload-data'?: boolean;
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
+ };
619
319
 
620
320
  /**
621
- * Deprecated
622
- * @defaultValue true
321
+ * Cell info of the list before layout.
623
322
  * @iOS
624
- * @deprecated since 2.10
323
+ * @Android
324
+ * @Harmony
325
+ * @PC
625
326
  */
626
- 'ios-update-valid-layout'?: boolean;
327
+ visibleItemBeforeUpdate?: ListItemInfo[];
627
328
 
628
329
  /**
629
- * Deprecated
630
- * @defaultValue false
330
+ * Cell info of the list after layout.
631
331
  * @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
332
  * @Android
333
+ * @Harmony
334
+ * @PC
640
335
  */
641
- 'android-enable-gap-item-decoration'?: boolean;
336
+ visibleItemAfterUpdate?: ListItemInfo[];
642
337
 
643
338
  /**
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
339
+ * The scroll info after layout.
340
+ * @iOS
646
341
  * @Android
342
+ * @Harmony
343
+ * @PC
647
344
  */
648
- 'android-trigger-sticky-layout'?: boolean;
345
+ scrollInfo: ListScrollInfo;
346
+ }
649
347
 
650
- /**
651
- * Specify this property as 'default' to enable update animation for the list.
652
- * @defaultValue "none"
653
- * @Android
654
- * @iOS
655
- */
656
- 'update-animation'?: 'none' | 'default';
348
+ export interface ListScrollEvent extends BaseEvent<'scroll', ListScrollInfo> {}
657
349
 
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;
350
+ export interface ListScrollToLowerEvent extends BaseEvent<'scrolltolower', ListScrollInfo> {}
664
351
 
665
- /**
666
- * Allows notification to send disappear event. It is recommended to enable.
667
- * @defaultValue false
668
- * @Android
669
- */
670
- 'enable-disappear'?: boolean;
352
+ export interface ListScrollToUpperEvent extends BaseEvent<'scrolltoupper', ListScrollInfo> {}
671
353
 
672
- /**
673
- * Enable asynchronous strategy
674
- * @defaultValue false
675
- * @Android
676
- * @iOS
677
- */
678
- 'enable-async-list'?: boolean;
354
+ export interface ListScrollStateChangeEvent extends BaseEvent<'scrollstatechange', ListScrollStateInfo> {}
679
355
 
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;
356
+ export interface ListSnapEvent extends BaseEvent<'snap', ListSnapInfo> {}
686
357
 
687
- /**
688
- * The maximum scrolling speed of the list, with a value between [0,1].
689
- * @defaultValue 1.0
690
- * @Android
691
- */
692
- 'max-fling-velocity-percent'?: number;
358
+ export interface ListLayoutCompleteEvent extends BaseEvent<'layoutcomplete', ListLayoutCompleteInfo> {}
693
359
 
360
+ export interface ListItemSnapAlignment {
694
361
  /**
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
362
+ * Paging factor, 0.0 means align to the top, while 1.0 means align to the bottom.
697
363
  * @Android
698
364
  * @iOS
365
+ * @Harmony
699
366
  */
700
- 'lower-threshold-item-count'?: number;
367
+ factor: number;
701
368
 
702
369
  /**
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
370
+ * In addition to the parameter of factor, an offset for alignment can be set, in px.
705
371
  * @Android
706
372
  * @iOS
373
+ * @Harmony
707
374
  */
708
- 'upper-threshold-item-count'?: number;
375
+ offset: number;
376
+ }
709
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 {
710
382
  /**
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
- * @Android
383
+ * Sets the scrolling direction and layout direction.
384
+ * @defaultValue 'vertical'
714
385
  * @iOS
386
+ * @Android
387
+ * @Harmony
388
+ * @PC
715
389
  */
716
- 'experimental-update-sticky-for-diff'?: boolean;
390
+ 'scroll-orientation'?: 'vertical' | 'horizontal';
717
391
 
718
392
  /**
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
393
+ * The number of columns or rows for the list, and only effective when list-type is 'flow' or 'waterfall'.
394
+ * @defaultValue 1
721
395
  * @Android
722
396
  * @iOS
397
+ * @Harmony
398
+ * @PC
723
399
  */
724
- 'upper-threshold'?: number;
400
+ 'span-count'?: number;
725
401
 
726
402
  /**
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
403
+ * layout type of the list
404
+ * @defaultValue 'single'
729
405
  * @Android
730
406
  * @iOS
407
+ * @Harmony
408
+ * @PC
731
409
  */
732
- 'lower-threshold'?: number;
410
+ 'list-type'?: 'single' | 'flow' | 'waterfall';
733
411
 
734
412
  /**
735
- * Control whether the 'attachedCells' is included in the scroll event callback parameters.
736
- * @defaultValue false
413
+ * Whether to allow scrolling for a list.
414
+ * @defaultValue true
737
415
  * @Android
738
416
  * @iOS
417
+ * @Harmony
418
+ * @PC
739
419
  */
740
- 'needs-visible-cells'?: boolean;
420
+ 'enable-scroll'?: boolean;
741
421
 
742
422
  /**
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.
423
+ * Indicates whether list can achieve nested scrolling with other scrollable containers. When enabled, the inner container scrolls first, followed by the outer container.
744
424
  * @defaultValue false
745
425
  * @Android
746
426
  * @iOS
747
427
  * @Harmony
428
+ * @PC
748
429
  */
749
- 'experimental-recycle-available-item-before-layout'?: boolean;
430
+ 'enable-nested-scroll'?: boolean;
750
431
 
751
- /**
752
- * Control whether the 'attachedCells' is included in the scroll event callback parameters on native list.
432
+ /**
433
+ * Declared on the list to control whether the list as a whole is allowed to be sticky at the top or bottom.
753
434
  * @defaultValue false
754
435
  * @Android
755
436
  * @iOS
756
- * @H
437
+ * @Harmony
438
+ * @PC
757
439
  */
758
- 'need-visible-item-info'?: boolean;
440
+ sticky?: boolean;
759
441
 
760
442
  /**
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
443
+ * The offset distance from the top or bottom of list for sticky positioning, in px.
444
+ * @defaultValue 0
763
445
  * @Android
764
446
  * @iOS
447
+ * @Harmony
448
+ * @PC
765
449
  */
766
- 'scroll-event-throttle'?: number;
450
+ 'sticky-offset'?: number;
767
451
 
768
452
  /**
769
- * List scrolling event refactoring switch. It is recommended to enable it.
770
- * @defaultValue false
453
+ * Control whether list should produce bounces effect when scrolling past its content boundaries.
454
+ * @defaultValue true
771
455
  * @iOS
456
+ * @Harmony
457
+ * @PC
772
458
  */
773
- 'ios-scroll-emitter-helper'?: boolean;
774
-
775
- /**
776
- * Solve the problem of inaccurate sliding distance in the list scrolling event callback. It is recommended to enable it.
777
- * @defaultValue false
778
- * @Android
779
- */
780
- 'android-new-scroll-top'?: boolean;
459
+ bounces?: boolean;
781
460
 
782
461
  /**
783
- * Allow frontend code to specify the automatic positioning of the list after rendering, only valid for single columns.
784
- * @defaultValue 0
462
+ * Specifies the node position to which list automatically scrolls after rendering.
463
+ * @defaultValue 0
785
464
  * @Android
786
465
  * @iOS
466
+ * @Harmony
467
+ * @PC
787
468
  */
788
469
  'initial-scroll-index'?: number;
789
470
 
790
471
  /**
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
794
- * @iOS
795
- * @experimental
796
- */
797
- 'paging-enabled'?: boolean;
798
-
799
- /**
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
803
- * @iOS
804
- * @experimental
805
- */
806
- 'item-snap'?: ListItemSnapAlignment;
807
-
808
- /**
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
472
+ * Controls whether the scroll event callback parameters include the position information of the currently rendering node.
473
+ * @defaultValue false
811
474
  * @Android
812
- */
813
- 'android-preference-consume-gesture'?: boolean;
814
-
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
475
  * @iOS
476
+ * @Harmony
477
+ * @PC
818
478
  */
819
- 'enable-nested-scroll'?: boolean;
820
-
821
-
822
- /**
823
- * NestedScrollOptions for scrollForward
824
- * @since 3.0
825
- * @H
826
- */
827
- 'temporary-nested-scroll-forward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel';
828
-
829
- /**
830
- * NestedScrollOptions for scrollBackward
831
- * @since 3.0
832
- * @H
833
- */
834
- 'temporary-nested-scroll-backward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel' ;
479
+ 'need-visible-item-info'?: boolean;
835
480
 
836
481
  /**
837
- * Preload count.
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.
838
483
  * @defaultValue 0
839
484
  * @Android
840
485
  * @iOS
841
- * @experimental
486
+ * @Harmony
487
+ * @PC
842
488
  */
843
- 'preload-buffer-count'?: number;
489
+ 'lower-threshold-item-count'?: number;
844
490
 
845
491
  /**
846
- * Whether to enable the self-preloading strategy of the list system.
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.
847
493
  * @defaultValue 0
848
494
  * @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
- * @iOS
857
- * @experimental
858
- */
859
- 'anchor-priority'?: 'fromBegin' | 'fromEnd';
860
-
861
- /**
862
- * When all nodes on the screen are deleted, find the anchor point outside the top/bottom area.
863
- * @defaultValue 'toTop'
864
495
  * @iOS
865
- * @experimental
496
+ * @Harmony
497
+ * @PC
866
498
  */
867
- 'delete-regress-policy'?: 'toTop' | 'toBottom';
499
+ 'upper-threshold-item-count'?: number;
868
500
 
869
501
  /**
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'
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
504
+ * @Android
872
505
  * @iOS
873
- * @experimental
506
+ * @Harmony
507
+ * @PC
874
508
  */
875
- 'insert-anchor-mode'?: 'outside' | 'inside';
509
+ 'scroll-event-throttle'?: number;
876
510
 
877
511
  /**
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'
512
+ * Enable the paging effect, and after each scroll, the list-item will stop at a specified position. For list-type:single only.
513
+ * @Android
880
514
  * @iOS
881
- * @experimental
515
+ * @Harmony
882
516
  */
883
- 'anchor-visibility'?: 'noAdjustment' | 'show' | 'hide';
517
+ 'item-snap'?: ListItemSnapAlignment;
884
518
 
885
519
  /**
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'
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
522
+ * @Android
888
523
  * @iOS
889
- * @experimental
524
+ * @Harmony
525
+ * @PC
890
526
  */
891
- 'anchor-align'?: 'toBottom' | 'toTop';
527
+ 'need-layout-complete-info'?: boolean;
892
528
 
893
529
  /**
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
530
+ * Used to mark the unique identifier for this data source update, which will be returned in the layoutcomplete event callback.
531
+ * @defaultValue -1
898
532
  * @Android
899
- */
900
- 'internal-cell-appear-notification'?: boolean;
901
-
902
- /**
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
533
  * @iOS
907
- * @Android
534
+ * @Harmony
535
+ * @PC
908
536
  */
909
- 'internal-cell-disappear-notification'?: boolean;
537
+ 'layout-id'?: number;
910
538
 
911
539
  /**
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
540
+ * This attribute controls the number of nodes outside list that are preloaded.
541
+ * @defaultValue 0
916
542
  * @Android
917
- */
918
- 'internal-cell-prepare-for-reuse-notification'?: boolean;
919
-
920
- /**
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
924
543
  * @iOS
925
- * @Android
544
+ * @Harmony
545
+ * @PC
926
546
  */
927
- 'should-request-state-restore'?: boolean;
547
+ 'preload-buffer-count'?: number;
928
548
 
929
549
  /**
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
550
+ * Whether to display the scroll bar of the list, with false on Harmony platform and true on other platforms.
551
+ * @defaultValue undefined
933
552
  * @iOS
934
- * @Android
935
- * @since 2.17
553
+ * @Harmony
554
+ * @PC
936
555
  */
937
- 'experimental-enable-preload-section'?: boolean;
556
+ 'scroll-bar-enable'?: boolean;
938
557
 
939
558
  /**
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
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
942
561
  * @Android
943
- * @since 2.17
944
- */
945
- 'android-enable-focus-search'?: boolean;
946
-
947
- /**
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
562
  * @iOS
951
- * @Android
952
- * @since 2.18
563
+ * @Harmony
564
+ * @PC
953
565
  */
954
- 'list-debug-info-level'?: number;
566
+ 'experimental-recycle-sticky-item'?: boolean;
955
567
 
956
568
  /**
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
960
- * @Android
961
- * @since 3.1
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
962
573
  */
963
- 'experimental-batch-render-strategy'?: BatchRenderStrategy;
574
+ 'harmony-scroll-edge-effect'?: boolean;
964
575
 
965
576
  /**
966
577
  * Scroll event.
967
578
  * @Android
968
579
  * @iOS
580
+ * @Harmony
581
+ * @PC
969
582
  */
970
583
  bindscroll?: EventHandler<ListScrollEvent>;
971
584
 
@@ -973,6 +586,8 @@ export interface ListProps extends StandardProps {
973
586
  * Callback function for scrolling to the top.
974
587
  * @Android
975
588
  * @iOS
589
+ * @Harmony
590
+ * @PC
976
591
  */
977
592
  bindscrolltoupper?: EventHandler<ListScrollToUpperEvent>;
978
593
 
@@ -980,6 +595,8 @@ export interface ListProps extends StandardProps {
980
595
  * Callback function for scrolling to the bottom.
981
596
  * @Android
982
597
  * @iOS
598
+ * @Harmony
599
+ * @PC
983
600
  */
984
601
  bindscrolltolower?: EventHandler<ListScrollToLowerEvent>;
985
602
 
@@ -987,148 +604,121 @@ export interface ListProps extends StandardProps {
987
604
  * This callback function is triggered when the scrolling state of the list changes.
988
605
  * @Android
989
606
  * @iOS
607
+ * @Harmony
608
+ * @PC
990
609
  */
991
610
  bindscrollstatechange?: EventHandler<ListScrollStateChangeEvent>;
611
+
992
612
  /**
993
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.
994
614
  * @Android
995
615
  * @iOS
616
+ * @Harmony
617
+ * @PC
996
618
  */
997
- bindlayoutcomplete?: EventHandler<ListLayoutFinishEvent> | EventHandler<LayoutCompleteEvent>;
998
- /**
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
1002
- * @iOS
1003
- */
1004
- bindlistdebugevent?: EventHandler<ListDebugInfoEvent>;
1005
- /**
1006
- * scrollview scrolls to upper edge
1007
- * @since 3.0
1008
- * @iOS
1009
- * @Android
1010
- * @H
1011
- */
1012
- bindscrolltoupperedge?: EventHandler<ListScrollToUpperEdgeEvent>;
619
+ bindlayoutcomplete?: EventHandler<ListLayoutCompleteEvent>;
1013
620
 
1014
621
  /**
1015
- * scrollview scrolls to lower edge
1016
- * @since 3.0
1017
- * @iOS
622
+ * Snap callback
623
+ * @since 2.16
1018
624
  * @Android
1019
- * @H
1020
- */
1021
- bindscrolltoloweredge?: EventHandler<ListScrollToLowerEdgeEvent>;
1022
-
1023
- /**
1024
- * scrollview scrolls to normal position. Not at upper or lower edge
1025
- * @since 3.0
1026
625
  * @iOS
1027
- * @Android
1028
- * @H
626
+ * @Harmony
1029
627
  */
1030
- bindscrolltonormalstate?: EventHandler<ListScrollToNormalStateEvent>;
628
+ bindsnap?: EventHandler<ListSnapEvent>;
1031
629
  }
1032
630
 
1033
- export interface ListItemProps extends StandardProps {
1034
- /**
1035
- * sticky top effect. Not compatible with flatten.
1036
- * @defaultValue false
1037
- * @Android
1038
- * @iOS
1039
- */
1040
- 'sticky-top'?: boolean;
1041
-
1042
- /**
1043
- * sticky bottom effect. Not compatible with flatten.
1044
- * @defaultValue false
1045
- * @Android
1046
- * @iOS
1047
- */
1048
- 'sticky-bottom'?: boolean;
1049
-
1050
- /**
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
1053
- * @Android
1054
- * @iOS
1055
- */
1056
- 'full-span'?: boolean;
1057
-
631
+ export interface ScrollToPositionParams {
1058
632
  /**
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
633
+ * Specify the index of the node to scroll to, with a value range of [0, itemCount).
1061
634
  * @Android
1062
635
  * @iOS
1063
- * @deprecated For Lynx>=3.1, use {@link estimated-main-axis-size-px} instead
636
+ * @Harmony
637
+ * @PC
1064
638
  */
1065
- 'estimated-height-px'?: number;
639
+ index: number;
1066
640
 
1067
641
  /**
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
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'
1070
647
  * @Android
1071
648
  * @iOS
1072
- * @deprecated For Lynx>=3.1, use {@link estimated-main-axis-size-px} instead
649
+ * @Harmony
650
+ * @PC
1073
651
  */
1074
- 'estimated-height'?: number;
652
+ alignTo?: 'bottom' | 'top' | 'middle';
1075
653
 
1076
654
  /**
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
655
+ * Align the node with alignTo, and then move the node downward by a length of offset.
656
+ * @defaultValue 0
1080
657
  * @Android
1081
658
  * @iOS
659
+ * @Harmony
660
+ * @PC
1082
661
  */
1083
- 'estimated-main-axis-size-px'?: number;
662
+ offset?: number;
1084
663
 
1085
664
  /**
1086
- * Snap callback
665
+ * Enable scroll animation during scroll.
666
+ * @defaultValue false
1087
667
  * @Android
1088
668
  * @iOS
669
+ * @Harmony
670
+ * @PC
1089
671
  */
1090
- bindsnap?: EventHandler<ListEvent<'snap'>>;
672
+ smooth?: boolean;
673
+ }
1091
674
 
1092
- /**
1093
- * @Android
1094
- * @iOS
1095
- */
1096
- 'item-key': string;
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';
1097
684
 
1098
- bindnodeappear?: EventHandler<AppearanceEvent>;
1099
- bindnodedisappear?: EventHandler<AppearanceEvent>;
685
+ params: ScrollToPositionParams;
1100
686
  }
1101
687
 
1102
- export interface ListRowProps extends ListItemProps {}
1103
-
1104
688
  /**
1105
- * Automatic scrolling
689
+ * Automatic scrolling.
1106
690
  * @Android
1107
691
  * @iOS
692
+ * @Harmony
1108
693
  */
1109
694
  export interface AutoScrollMethod extends BaseMethod {
1110
695
  method: 'autoScroll';
1111
696
  params: {
1112
697
  /**
1113
- * 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
1114
700
  * @Android
1115
701
  * @iOS
702
+ * @Harmony
1116
703
  */
1117
- rate: string;
704
+ start?: boolean;
705
+
1118
706
  /**
1119
- * Start/stop automatic scrolling.
1120
- * @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).
1121
708
  * @Android
1122
709
  * @iOS
710
+ * @Harmony
1123
711
  */
1124
- start: boolean;
712
+ rate: string;
713
+
1125
714
  /**
1126
715
  * Whether to stop automatically when sliding to the bottom.
1127
716
  * @defaultValue true
1128
717
  * @Android
1129
718
  * @iOS
719
+ * @Harmony
1130
720
  */
1131
- autoStop: boolean;
721
+ autoStop?: boolean;
1132
722
  };
1133
723
  }
1134
724
 
@@ -1136,93 +726,33 @@ export interface AutoScrollMethod extends BaseMethod {
1136
726
  * Get the info of the currently displayed list item.
1137
727
  * @Android
1138
728
  * @iOS
729
+ * @Harmony
730
+ * @PC
1139
731
  */
1140
732
  export interface GetVisibleCellsMethod extends BaseMethod {
1141
733
  method: 'getVisibleCells';
1142
734
  }
1143
735
 
1144
736
  /**
1145
- * Get the index of the currently displayed list item.
1146
- * @Android
1147
- */
1148
- export interface GetVisibleItemsPositionsMethod extends BaseMethod {
1149
- method: 'getVisibleItemsPositions';
1150
- }
1151
-
1152
- /**
1153
- * Remove current sticky view.
1154
- * @Android
1155
- */
1156
- export interface RemoveStickyViewMethod extends BaseMethod {
1157
- method: 'removeStickyView';
1158
- }
1159
-
1160
- /**
1161
- * Init the cache of the list.
1162
- * @Android
1163
- */
1164
- export interface InitCacheMethod extends BaseMethod {
1165
- method: 'initCache';
1166
- }
1167
-
1168
- /**
1169
- * Scroll the list to the specified position.
737
+ * Scroll by specified offset
1170
738
  * @Android
1171
739
  * @iOS
740
+ * @Harmony
741
+ * @PC
1172
742
  */
1173
- export interface ScrollToPositionMethod extends BaseMethod {
1174
- method: 'scrollToPosition';
1175
- params: {
1176
- /**
1177
- * 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).
1178
- * @deprecated 2.17
1179
- * @Android
1180
- * @iOS
1181
- */
1182
- position: number;
1183
-
1184
- /**
1185
- * Specify the index of the node to scroll to, with a value range of [0, itemCount).
1186
- * @since 2.17
1187
- * @Android
1188
- * @iOS
1189
- */
1190
- index: number;
1191
-
1192
- /**
1193
- * Specify the alignment method when scrolling to a target position.
1194
- * "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.
1195
- * "bottom": Scroll to make the node fully visible in the list and align the bottom of the node with the bottom of the list.
1196
- * "top": Scroll to make the node fully visible in the list and align the top of the node with the top of the list.
1197
- * "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.
1198
- * @defaultValue none
1199
- * @Android
1200
- * @iOS
1201
- */
1202
- alignTo?: 'none' | 'bottom' | 'top' | 'middle';
1203
-
1204
- /**
1205
- * Align the node with alignTo, and then move the node downward by a length of offset.
1206
- * @Android
1207
- * @iOS
1208
- */
1209
- offset?: number;
743
+ export interface ScrollByMethod extends BaseMethod {
744
+ method: 'scrollBy';
1210
745
 
746
+ params: {
1211
747
  /**
1212
- * Enable scroll animation during scroll.
1213
- * @defaultValue false
748
+ * Offset to scroll, in px.
1214
749
  * @Android
1215
750
  * @iOS
751
+ * @Harmony
752
+ * @PC
1216
753
  */
1217
- smooth?: boolean;
1218
-
1219
- /**
1220
- * When enabled, it uses the refactored logic which helps to solve some existing bugs. It is recommended to enable it.
1221
- * @defaultValue false
1222
- * @iOS
1223
- */
1224
- useScroller?: boolean;
754
+ offset: number;
1225
755
  };
1226
756
  }
1227
757
 
1228
- export type ListUIMethods = ScrollToPositionMethod | AutoScrollMethod | GetVisibleCellsMethod | GetVisibleItemsPositionsMethod | RemoveStickyViewMethod | InitCacheMethod;
758
+ export type ListUIMethods = ScrollToPositionMethod | AutoScrollMethod | GetVisibleCellsMethod | ScrollByMethod;