js: declare scroll to item with top offset api

This commit is contained in:
王劲鹏
2023-08-03 18:58:28 +08:00
committed by osborn
parent e3ca9ae5d4
commit c4eee8ad4a
11 changed files with 990 additions and 574 deletions

View File

@@ -114,9 +114,19 @@ export class List extends Superview {
@Property
preloadItemCount?: number
scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) {
/**
* @param {number} config.topOffset - 目标位置cell的顶部偏移量
*/
scrollToItem(context: BridgeContext,
index: number,
config?: {
animated?: boolean,
topOffset?: number
}) {
const animated = config?.animated
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
const topOffset = config?.topOffset;
return this.nativeChannel(context, 'scrollToItem')({ index, animated, topOffset }) as Promise<any>
}
/**
* @param context