feat: add preloadItemCount for List, incase we need preload more items before scroll to end

This commit is contained in:
pengfei.zhou
2023-03-09 10:55:32 +08:00
committed by jingpeng
parent 4103704162
commit 0774df96e1
26 changed files with 4495 additions and 2639 deletions

View File

@@ -1,6 +1,6 @@
import { Color } from "../util/color";
import { Modeling, Model } from "../util/types";
export declare type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha";
export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY" | "rotationX" | "rotationY" | "backgroundColor" | "alpha";
export declare enum RepeatMode {
RESTART = 1,
REVERSE = 2

View File

@@ -7,14 +7,14 @@ import { FlexConfig } from "../util/flexbox";
export declare function Property(target: Object, propKey: string): void;
export declare function InconsistProperty(target: Object, propKey: string): void;
export declare function ViewComponent(constructor: ClassType<any>): void;
export declare type NativeViewModel = {
export type NativeViewModel = {
id: string;
type: string;
props: {
[index: string]: Model;
};
};
declare type RefType<T> = T extends Ref<infer R> ? R : never;
type RefType<T> = T extends Ref<infer R> ? R : never;
export declare class Ref<T extends View> {
private view?;
set current(v: T);
@@ -151,8 +151,8 @@ export declare abstract class Superview extends View {
clean(): void;
toModel(): NativeViewModel;
}
export declare type ViewArray = View[];
export declare type ViewFragment = View | ViewArray | undefined | null;
export type ViewArray = View[];
export type ViewFragment = View | ViewArray | undefined | null;
export declare abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
padding?: {
left?: number;

View File

@@ -43,6 +43,24 @@ export function createRef() {
return new Ref;
}
export class View {
callback2Id(f) {
const id = uniqueId('Function');
this.callbacks.set(id, f);
return id;
}
id2Callback(id) {
let f = this.callbacks.get(id);
if (f === undefined) {
f = Reflect.get(this, id);
}
return f;
}
findViewByTag(tag) {
if (tag === this.tag) {
return this;
}
return undefined;
}
constructor() {
this.width = 0;
this.height = 0;
@@ -74,24 +92,6 @@ export class View {
}
});
}
callback2Id(f) {
const id = uniqueId('Function');
this.callbacks.set(id, f);
return id;
}
id2Callback(id) {
let f = this.callbacks.get(id);
if (f === undefined) {
f = Reflect.get(this, id);
}
return f;
}
findViewByTag(tag) {
if (tag === this.tag) {
return this;
}
return undefined;
}
/** Anchor start*/
get left() {
return this.x;