Ok diff interface to avoid collapsed views

This commit is contained in:
Eric Bailey
2025-06-23 13:24:38 -05:00
parent bff64b78d1
commit d7a644e759
3 changed files with 17 additions and 21 deletions
+10 -10
View File
@@ -95,8 +95,10 @@ export function Outer({
* Once opened, measure the dimensions and position of the target * Once opened, measure the dimensions and position of the target
*/ */
targetRef.current.measure((_x, _y, width, height, pageX, pageY) => { targetRef.current.measure((_x, _y, width, height, pageX, pageY) => {
setTargetMeasurements({x: pageX, y: pageY, width, height}) if (pageX !== undefined && pageY !== undefined && width && height) {
setReady(true) setTargetMeasurements({x: pageX, y: pageY, width, height})
setReady(true)
}
}) })
} }
} else if (!requestVisible && prevRequestVisible) { } else if (!requestVisible && prevRequestVisible) {
@@ -123,16 +125,14 @@ export function Outer({
) )
} }
export function Target({ export function Target({children}: {children: React.ReactNode}) {
children,
}: {
children: (props: {ref: TargetContextType['targetRef']}) => React.ReactNode
}) {
const {targetRef} = useContext(TargetContext) const {targetRef} = useContext(TargetContext)
return children({ return (
ref: targetRef, <View collapsable={false} ref={targetRef}>
}) {children}
</View>
)
} }
export function Content({ export function Content({
+6 -6
View File
@@ -38,12 +38,12 @@ export function Outer({
) )
} }
export function Target({ export function Target({children}: {children: React.ReactNode}) {
children, return (
}: { <Popover.Trigger asChild>
children: (props: {ref: undefined}) => React.ReactNode <View collapsable={false}>{children}</View>
}) { </Popover.Trigger>
return <Popover.Trigger asChild>{children({ref: undefined})}</Popover.Trigger> )
} }
export function Content({ export function Content({
@@ -218,11 +218,7 @@ let ProfileHeaderStandard = ({
visible={visible} visible={visible}
onVisibleChange={setVisible}> onVisibleChange={setVisible}>
<Tooltip.Target> <Tooltip.Target>
{({ref}) => ( <MessageProfileButton profile={profile} />
<View ref={ref}>
<MessageProfileButton profile={profile} />
</View>
)}
</Tooltip.Target> </Tooltip.Target>
<Tooltip.TextBubble> <Tooltip.TextBubble>
<Text> <Text>