-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: rn event target #1753
base: master
Are you sure you want to change the base?
Feat: rn event target #1753
Conversation
@@ -477,7 +477,8 @@ interface LayoutConfig { | |||
export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }: LayoutConfig) => { | |||
const layoutRef = useRef({}) | |||
const hasLayoutRef = useRef(false) | |||
const layoutStyle: Record<string, any> = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} | |||
const isFirstRender = useRef(true) | |||
const layoutStyle: Record<string, any> = isFirstRender.current && !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const layoutStyle = useMemo(()=>{return !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {}}, [hasLayoutRef.current])
应该改为上面这种,不然第二次渲染必定会show,还是可能造成闪烁
@@ -41,10 +41,22 @@ const getTouchEvent = ( | |||
} | |||
) | |||
|
|||
const pendingProps = (event as any)._targetInst?.pendingProps || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个东西试一下生产模式和安卓下是否都存在
@@ -477,7 +477,8 @@ interface LayoutConfig { | |||
export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }: LayoutConfig) => { | |||
const layoutRef = useRef({}) | |||
const hasLayoutRef = useRef(false) | |||
const layoutStyle: Record<string, any> = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} | |||
const isFirstRender = useRef(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要
No description provided.