feat:add onScroll and onScrollEnd for list and flowlayout

This commit is contained in:
pengfei.zhou
2020-03-11 13:41:22 +08:00
committed by osborn
parent 8db0e8e9f9
commit 7b371ca58b
16 changed files with 316 additions and 5 deletions

View File

@@ -48,6 +48,10 @@ export interface IFlowLayout extends IView {
onLoadMore?: () => void
loadMoreView?: FlowLayoutItem
onScroll?: (offset: { x: number, y: number }) => void
onScrollEnd?: (offset: { x: number, y: number }) => void
}
export class FlowLayout extends Superview implements IFlowLayout {
@@ -89,6 +93,12 @@ export class FlowLayout extends Superview implements IFlowLayout {
@Property
loadMoreView?: FlowLayoutItem
@Property
onScroll?: (offset: { x: number, y: number }) => void
@Property
onScrollEnd?: (offset: { x: number, y: number }) => void
reset() {
this.cachedViews.clear()
this.itemCount = 0

View File

@@ -32,11 +32,20 @@ export class ListItem extends Stack implements IListItem {
export interface IList extends IView {
renderItem: (index: number) => ListItem
itemCount: number
batchCount?: number
onLoadMore?: () => void
loadMore?: boolean
loadMoreView?: ListItem
onScroll?: (offset: { x: number, y: number }) => void
onScrollEnd?: (offset: { x: number, y: number }) => void
}
export class List extends Superview implements IList {
@@ -69,6 +78,12 @@ export class List extends Superview implements IList {
@Property
loadMoreView?: ListItem
@Property
onScroll?: (offset: { x: number, y: number }) => void
@Property
onScrollEnd?: (offset: { x: number, y: number }) => void
reset() {
this.cachedViews.clear()
this.itemCount = 0