feat: add observeScrollingInterval in coordinator plugin

This commit is contained in:
pengfei.zhou
2023-03-13 22:09:57 +08:00
committed by osborn
parent 7db5d68db5
commit 52e5977d20
12 changed files with 247 additions and 15 deletions

View File

@@ -18,4 +18,10 @@ export declare function coordinator(context: BridgeContext): {
end: number | Color;
};
}) => void;
observeScrollingInterval: (argument: {
scrollable: Scroller | List | FlowLayout;
observingInterval: number[];
inclusive?: "Left" | "Right" | undefined;
onScrolledInterval: (n: number) => void;
}) => void;
};

View File

@@ -29,6 +29,16 @@ export function coordinator(context) {
context.callNative("coordinator", "verticalScrolling", argument);
});
}
}
},
observeScrollingInterval: (argument) => {
if (context.entity instanceof Panel) {
const panel = context.entity;
panel.addOnRenderFinishedCallback(() => {
argument.scrollable = viewIdChains(argument.scrollable);
argument.onScrolledInterval = context.function2Id(argument.onScrolledInterval);
context.callNative("coordinator", "observeScrollingInterval", argument);
});
}
},
};
}