list add findVisibleItems api
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import { Stack } from './layouts'
|
||||
import { Property, Superview, View, NativeViewModel } from '../ui/view'
|
||||
import { layoutConfig } from '../util/index.util'
|
||||
import { BridgeContext } from '../..'
|
||||
|
||||
export class FlowLayoutItem extends Stack {
|
||||
/**
|
||||
@@ -94,6 +95,21 @@ export class FlowLayout extends Superview {
|
||||
|
||||
@Property
|
||||
footer?: FlowLayoutItem
|
||||
/**
|
||||
* @param context
|
||||
* @returns Returns the range of the visible views for each column.
|
||||
*/
|
||||
findVisibleItems(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'findVisibleItems')() as Promise<{ first: number, last: number }[]>
|
||||
}
|
||||
/**
|
||||
* @param context
|
||||
* @returns Returns the range of the completely visible views for each column.
|
||||
*/
|
||||
findCompletelyVisibleItems(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'findCompletelyVisibleItems')() as Promise<{ first: number, last: number }[]>
|
||||
}
|
||||
|
||||
|
||||
reset() {
|
||||
this.cachedViews.clear()
|
||||
|
@@ -35,6 +35,12 @@ export class ListItem extends Stack {
|
||||
}[]
|
||||
}
|
||||
|
||||
export enum OtherItems {
|
||||
LoadMore = -10,
|
||||
Header = -11,
|
||||
Footer = -12,
|
||||
}
|
||||
|
||||
export class List extends Superview {
|
||||
private cachedViews: Map<string, ListItem> = new Map
|
||||
|
||||
@@ -97,6 +103,20 @@ export class List extends Superview {
|
||||
const animated = config?.animated
|
||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
|
||||
}
|
||||
/**
|
||||
* @param context
|
||||
* @returns Returns the range of the visible views.
|
||||
*/
|
||||
findVisibleItems(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'findVisibleItems')() as Promise<{ first: number, last: number }>
|
||||
}
|
||||
/**
|
||||
* @param context
|
||||
* @returns Returns the range of the completely visible views.
|
||||
*/
|
||||
findCompletelyVisibleItems(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'findCompletelyVisibleItems')() as Promise<{ first: number, last: number }>
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.cachedViews.clear()
|
||||
|
Reference in New Issue
Block a user