feat:List add header and footer
This commit is contained in:
@@ -39,11 +39,17 @@ export class List extends Superview {
|
||||
private cachedViews: Map<string, ListItem> = new Map
|
||||
|
||||
allSubviews() {
|
||||
const ret = [...this.cachedViews.values()]
|
||||
if (this.loadMoreView) {
|
||||
return [...this.cachedViews.values(), this.loadMoreView]
|
||||
} else {
|
||||
return this.cachedViews.values()
|
||||
ret.push(this.loadMoreView)
|
||||
}
|
||||
if (this.header) {
|
||||
ret.push(this.header)
|
||||
}
|
||||
if (this.footer) {
|
||||
ret.push(this.footer)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@Property
|
||||
@@ -81,6 +87,12 @@ export class List extends Superview {
|
||||
@Property
|
||||
bounces?: boolean
|
||||
|
||||
@Property
|
||||
header?: ListItem
|
||||
|
||||
@Property
|
||||
footer?: ListItem
|
||||
|
||||
scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) {
|
||||
const animated = config?.animated
|
||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise<any>
|
||||
@@ -108,6 +120,12 @@ export class List extends Superview {
|
||||
if (this.loadMoreView) {
|
||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
|
||||
}
|
||||
if (this.header) {
|
||||
this.dirtyProps['header'] = this.header.viewId
|
||||
}
|
||||
if (this.footer) {
|
||||
this.dirtyProps['footer'] = this.footer.viewId
|
||||
}
|
||||
return super.toModel()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user