From 77e6188fb378c9f2f80665cea85808349674cc56 Mon Sep 17 00:00:00 2001 From: lareinayanyu Date: Fri, 6 Dec 2024 15:44:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20opacity:0=20=E6=B3=A8=E5=85=A5=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webpack-plugin/lib/runtime/components/react/utils.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/webpack-plugin/lib/runtime/components/react/utils.tsx b/packages/webpack-plugin/lib/runtime/components/react/utils.tsx index 4858486b3d..a24fa9a96d 100644 --- a/packages/webpack-plugin/lib/runtime/components/react/utils.tsx +++ b/packages/webpack-plugin/lib/runtime/components/react/utils.tsx @@ -487,7 +487,8 @@ interface LayoutConfig { export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }: LayoutConfig) => { const layoutRef = useRef({}) const hasLayoutRef = useRef(false) - const layoutStyle: Record = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} + const isFistRender = useRef(true) + const layoutStyle: Record = isFistRender && !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} const layoutProps: Record = {} const enableOffset = props['enable-offset'] if (hasSelfPercent || onLayout || enableOffset) { @@ -507,6 +508,7 @@ export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout props.onLayout && props.onLayout(e) } } + isFistRender.current = false return { layoutRef, layoutStyle,