fix: calc scrollheight dynamically for tabs change

This commit is contained in:
jialin
2025-11-10 20:40:15 +08:00
parent 285e274818
commit 9eb1dba4a1
14 changed files with 283 additions and 77 deletions
+21 -8
View File
@@ -22,14 +22,20 @@ const ColumnWrapper: React.FC<ColumnWrapperProps> = ({
styles = {}
}) => {
const scroller = React.useRef<any>(null);
const { initialize, instance, scrollToBottom, scrollToTarget } =
useOverlayScroller({
options: {
scrollbars: {
autoHide: 'move'
}
const {
initialize,
instance,
scrollEventElement,
scrollToBottom,
scrollToTarget,
getScrollElementScrollableHeight
} = useOverlayScroller({
options: {
scrollbars: {
autoHide: 'move'
}
});
}
});
React.useEffect(() => {
if (scroller.current) {
@@ -39,7 +45,14 @@ const ColumnWrapper: React.FC<ColumnWrapperProps> = ({
return (
<WrapperContext.Provider
value={{ osInstance: instance, scrollToBottom, scrollToTarget }}
value={{
scroller: scroller,
osInstance: instance,
scrollEventElement,
getScrollElementScrollableHeight,
scrollToBottom,
scrollToTarget
}}
>
<div
className="column-wrapper-footer"
@@ -2,8 +2,14 @@ import { createContext, useContext } from 'react';
interface WrapperContextProps {
osInstance?: any;
scroller?: any;
scrollEventElement?: any;
scrollToBottom?: () => void;
scrollToTop?: () => void;
getScrollElementScrollableHeight?: () => {
scrollHeight: number;
scrollTop: number;
};
scrollToTarget?: (target: any, offset?: number) => void;
}