fix native post meta (#4530)

This commit is contained in:
Hailey 2024-06-16 02:23:48 -07:00 committed by GitHub
parent eaef1446f2
commit d0bb97e8a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 47 deletions

View file

@ -51,10 +51,23 @@ const floatingMiddlewares = [
]
export function ProfileHoverCard(props: ProfileHoverCardProps) {
const prefetchProfileQuery = usePrefetchProfileQuery()
const prefetchedProfile = React.useRef(false)
const onPointerMove = () => {
if (!prefetchedProfile.current) {
prefetchedProfile.current = true
prefetchProfileQuery(props.did)
}
}
if (props.disable || isTouchDevice) {
return props.children
} else {
return <ProfileHoverCardInner {...props} />
return (
<View onPointerMove={onPointerMove}>
<ProfileHoverCardInner {...props} />
</View>
)
}
}