chore: compatibility api

This commit is contained in:
jialin
2025-03-31 16:21:40 +08:00
parent f9469a1ea3
commit bd6c689d91
24 changed files with 848 additions and 374 deletions
+34
View File
@@ -0,0 +1,34 @@
import useOverlayScroller from '@/hooks/use-overlay-scroller';
import React from 'react';
import styled from 'styled-components';
const Wrapper = styled.div<{ $maxHeight?: number }>`
max-height: ${({ $maxHeight }) =>
typeof $maxHeight === 'number' ? `${$maxHeight}px` : $maxHeight};
overflow-y: auto;
width: 100%;
padding-inline: 10px;
`;
const OverlayScroller: React.FC<any> = ({ children, maxHeight, theme }) => {
const scroller = React.useRef<any>(null);
const { initialize } = useOverlayScroller({
options: {
theme: theme || 'os-theme-light'
}
});
React.useEffect(() => {
if (scroller.current) {
initialize(scroller.current);
}
}, []);
return (
<Wrapper ref={scroller} $maxHeight={maxHeight || '100%'} hidden={false}>
{children}
</Wrapper>
);
};
export default OverlayScroller;