Deprecate 'variant' in favor of 'color'

This commit is contained in:
Eric Bailey
2025-07-30 15:36:15 -05:00
parent 61b48dcdb9
commit 16e915a67c
2 changed files with 10 additions and 7 deletions
+10
View File
@@ -31,6 +31,7 @@ export type ButtonShape = 'round' | 'square' | 'default'
export type VariantProps = {
/**
* The style variation of the button
* @deprecated Use `color` instead.
*/
variant?: ButtonVariant
/**
@@ -123,6 +124,15 @@ export const Button = React.forwardRef<View, ButtonProps>(
},
ref,
) => {
/**
* The `variant` prop is deprecated in favor of simply specifying `color`.
* If a `color` is set, then we want to use the existing codepaths for
* "solid" buttons. This is to maintain backwards compatibility.
*/
if (!variant && color) {
variant = 'solid'
}
const t = useTheme()
const [state, setState] = React.useState({
pressed: false,
-7
View File
@@ -52,7 +52,6 @@ function StorybookInner() {
<>
<View style={[a.flex_row, a.align_start, a.gap_md]}>
<Button
variant="outline"
color="primary"
size="small"
label='Set theme to "system"'
@@ -60,7 +59,6 @@ function StorybookInner() {
<ButtonText>System</ButtonText>
</Button>
<Button
variant="solid"
color="secondary"
size="small"
label='Set theme to "light"'
@@ -68,7 +66,6 @@ function StorybookInner() {
<ButtonText>Light</ButtonText>
</Button>
<Button
variant="solid"
color="secondary"
size="small"
label='Set theme to "dim"'
@@ -79,7 +76,6 @@ function StorybookInner() {
<ButtonText>Dim</ButtonText>
</Button>
<Button
variant="solid"
color="secondary"
size="small"
label='Set theme to "dark"'
@@ -94,7 +90,6 @@ function StorybookInner() {
<Buttons />
<Button
variant="solid"
color="primary"
size="small"
onPress={() => navigation.navigate('SharedPreferencesTester')}
@@ -129,7 +124,6 @@ function StorybookInner() {
<Settings />
<Button
variant="solid"
color="primary"
size="large"
label="Switch to Contained List"
@@ -140,7 +134,6 @@ function StorybookInner() {
) : (
<>
<Button
variant="solid"
color="primary"
size="large"
label="Switch to Storybook"