Fix button overflow

This commit is contained in:
Eric Bailey
2024-02-15 19:41:17 -06:00
parent 700693b87b
commit 014b6222e4
+22 -13
View File
@@ -362,6 +362,8 @@ export function Button({
[state, variant, color, size, disabled], [state, variant, color, size, disabled],
) )
const flattenedBaseStyles = flatten(baseStyles)
return ( return (
<Pressable <Pressable
role="button" role="button"
@@ -378,9 +380,8 @@ export function Button({
a.flex_row, a.flex_row,
a.align_center, a.align_center,
a.justify_center, a.justify_center,
a.overflow_hidden,
a.justify_center, a.justify_center,
...baseStyles, flattenedBaseStyles,
...(state.hovered || state.pressed ? hoverStyles : []), ...(state.hovered || state.pressed ? hoverStyles : []),
...(state.focused ? focusStyles : []), ...(state.focused ? focusStyles : []),
flatten(style), flatten(style),
@@ -392,17 +393,25 @@ export function Button({
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur}> onBlur={onBlur}>
{variant === 'gradient' && ( {variant === 'gradient' && (
<LinearGradient <View
colors={ style={[
state.hovered || state.pressed || state.focused a.absolute,
? gradientHoverColors a.inset_0,
: gradientColors a.overflow_hidden,
} {borderRadius: flattenedBaseStyles.borderRadius},
locations={gradientLocations} ]}>
start={{x: 0, y: 0}} <LinearGradient
end={{x: 1, y: 1}} colors={
style={[a.absolute, a.inset_0]} state.hovered || state.pressed || state.focused
/> ? gradientHoverColors
: gradientColors
}
locations={gradientLocations}
start={{x: 0, y: 0}}
end={{x: 1, y: 1}}
style={[a.absolute, a.inset_0]}
/>
</View>
)} )}
<Context.Provider value={context}> <Context.Provider value={context}>
{typeof children === 'string' ? ( {typeof children === 'string' ? (