Fix collapsed button by simplifying, keep container width (#9712)
This commit is contained in:
@@ -33,7 +33,7 @@ export function GrowthHack({
|
|||||||
a.relative,
|
a.relative,
|
||||||
a.justify_center,
|
a.justify_center,
|
||||||
align === 'right' ? a.align_end : a.align_start,
|
align === 'right' ? a.align_end : a.align_start,
|
||||||
width === undefined ? {opacity: 0} : {minWidth: width},
|
{minWidth: width ?? iconSizes[ICON_SIZE]},
|
||||||
]}>
|
]}>
|
||||||
<PrivacySensitive
|
<PrivacySensitive
|
||||||
style={[
|
style={[
|
||||||
@@ -46,14 +46,15 @@ export function GrowthHack({
|
|||||||
// when finding the size of the button, we need the containing
|
// when finding the size of the button, we need the containing
|
||||||
// element to have a concrete size otherwise the text will
|
// element to have a concrete size otherwise the text will
|
||||||
// collapse to 0 width. so set it to a really big number
|
// collapse to 0 width. so set it to a really big number
|
||||||
// and hide the entire thing (see above)
|
// and just use `pointer-events: box-none` so it doesn't interfere with the UI
|
||||||
width === undefined && {width: 10000},
|
{width: 1000},
|
||||||
|
a.pointer_events_box_none,
|
||||||
]}>
|
]}>
|
||||||
<View
|
<View
|
||||||
onLayout={evt => setWidth(evt.nativeEvent.layout.width)}
|
onLayout={evt => setWidth(evt.nativeEvent.layout.width)}
|
||||||
style={[
|
style={[
|
||||||
t.atoms.bg,
|
t.atoms.bg,
|
||||||
// make sure it covers the icon! the won't always be a button
|
// make sure it covers the icon! children might be undefined
|
||||||
{minWidth: iconSizes[ICON_SIZE], minHeight: iconSizes[ICON_SIZE]},
|
{minWidth: iconSizes[ICON_SIZE], minHeight: iconSizes[ICON_SIZE]},
|
||||||
]}>
|
]}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user