diff --git a/packages/webpack-plugin/lib/runtime/components/react/mpx-video.tsx b/packages/webpack-plugin/lib/runtime/components/react/mpx-video.tsx index 02417fb42..132139e26 100644 --- a/packages/webpack-plugin/lib/runtime/components/react/mpx-video.tsx +++ b/packages/webpack-plugin/lib/runtime/components/react/mpx-video.tsx @@ -188,7 +188,7 @@ const MpxVideo = forwardRef, VideoProps>((videoProp hasSelfPercent, setWidth, setHeight, - nodeRef: videoRef + nodeRef: viewRef }) useNodesRef(props, ref, viewRef, { diff --git a/packages/webpack-plugin/lib/runtime/components/react/utils.tsx b/packages/webpack-plugin/lib/runtime/components/react/utils.tsx index 08fac9557..572dc2b67 100644 --- a/packages/webpack-plugin/lib/runtime/components/react/utils.tsx +++ b/packages/webpack-plugin/lib/runtime/components/react/utils.tsx @@ -511,6 +511,7 @@ export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout const hasLayoutRef = useRef(false) const layoutStyle = useMemo(() => { return !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} }, [hasLayoutRef.current]) const layoutProps: Record = {} + const navigation = useNavigation() const enableOffset = props['enable-offset'] if (hasSelfPercent || onLayout || enableOffset) { layoutProps.onLayout = (e: LayoutChangeEvent) => { @@ -522,7 +523,8 @@ export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout } if (enableOffset) { nodeRef.current?.measure((x: number, y: number, width: number, height: number, offsetLeft: number, offsetTop: number) => { - layoutRef.current = { x, y, width, height, offsetLeft, offsetTop } + const { y: navigationY = 0 } = navigation?.layout || {} + layoutRef.current = { x, y: y - navigationY, width, height, offsetLeft, offsetTop: offsetTop - navigationY } }) } onLayout && onLayout(e)