diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e85531b338..79803b091b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19740,4 +19740,4 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} - dev: true + dev: true \ No newline at end of file diff --git a/src/packages/sticky/sticky.taro.tsx b/src/packages/sticky/sticky.taro.tsx index a3bc35b097..457dd3c869 100644 --- a/src/packages/sticky/sticky.taro.tsx +++ b/src/packages/sticky/sticky.taro.tsx @@ -96,7 +96,15 @@ export const Sticky: FunctionComponent> = (props) => { zIndex, } return style - }, [fixed, rootRect.height, rootRect.width, transform, position, threshold]) + }, [ + fixed, + rootRect.height, + rootRect.width, + transform, + position, + threshold, + zIndex, + ]) const handleScroll: any = async (scrollTop: number) => { const curRootRect = await getRectByTaro(rootRef.current) diff --git a/src/packages/sticky/sticky.tsx b/src/packages/sticky/sticky.tsx index f9d1ede1b6..70ba6510c6 100644 --- a/src/packages/sticky/sticky.tsx +++ b/src/packages/sticky/sticky.tsx @@ -49,8 +49,8 @@ export const Sticky: FunctionComponent> = (props) => { zIndex, }) useEffect(() => { - setStickyStyle({ ...stickyStyle, [position]: `${threshold}px` }) - }, [threshold, position]) + setStickyStyle({ ...stickyStyle, [position]: `${threshold}px`, zIndex }) + }, [threshold, position, zIndex]) const [rootStyle, setRootStyle] = useState({}) const getElement = useCallback(() => {