Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions example/src/Examples/ButtonExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ class ButtonExample extends React.Component<Props, State> {
>
Loading
</Button>
<Button
mode="outlined"
onPress={() => {}}
style={styles.button}
labelStyle={{
fontWeight: '800',
fontSize: 18,
}}
>
Custom Font
</Button>
</View>
</List.Section>
<List.Section title="Contained button">
Expand Down
15 changes: 14 additions & 1 deletion src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import * as React from 'react';
import { Animated, View, ViewStyle, StyleSheet, StyleProp } from 'react-native';
import {
Animated,
View,
ViewStyle,
StyleSheet,
StyleProp,
TextStyle,
} from 'react-native';
import color from 'color';

import ActivityIndicator from './ActivityIndicator';
Expand Down Expand Up @@ -66,6 +73,10 @@ type Props = React.ComponentProps<typeof Surface> & {
*/
contentStyle?: StyleProp<ViewStyle>;
style?: StyleProp<ViewStyle>;
/**
* Style for the button text.
*/
labelStyle?: StyleProp<TextStyle>;
/**
* @optional
*/
Expand Down Expand Up @@ -152,6 +163,7 @@ class Button extends React.Component<Props, State> {
style,
theme,
contentStyle,
labelStyle,
...rest
} = this.props;
const { colors, roundness } = theme;
Expand Down Expand Up @@ -271,6 +283,7 @@ class Button extends React.Component<Props, State> {
uppercase && styles.uppercaseLabel,
textStyle,
font,
labelStyle,
]}
>
{children}
Expand Down
3 changes: 3 additions & 0 deletions src/components/__tests__/__snapshots__/Banner.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -455,6 +456,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -545,6 +547,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down
8 changes: 8 additions & 0 deletions src/components/__tests__/__snapshots__/Button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ exports[`renders button with color 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -213,6 +214,7 @@ exports[`renders button with icon 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -310,6 +312,7 @@ exports[`renders contained contained with mode 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -404,6 +407,7 @@ exports[`renders disabled button 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -677,6 +681,7 @@ exports[`renders loading button 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -767,6 +772,7 @@ exports[`renders outlined button with mode 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -857,6 +863,7 @@ exports[`renders text button by default 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -947,6 +954,7 @@ exports[`renders text button with mode 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/__tests__/__snapshots__/Menu.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ exports[`renders menu with content styles 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -176,6 +177,7 @@ exports[`renders not visible menu 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down Expand Up @@ -270,6 +272,7 @@ exports[`renders visible menu 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ exports[`renders snackbar with action button 1`] = `
"fontFamily": "System",
"fontWeight": "500",
},
undefined,
],
]
}
Expand Down