diff --git a/README.md b/README.md index b7d0d962..574e192b 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ An object container - `color`: color of segment text - `fontSize`: font-size of segment text - `fontFamily`: font-family of segment text +- `fontWeight`: font-weight of segment text ### `activeFontStyle` @@ -213,6 +214,7 @@ An object container - `color`: overrides color of selected segment text - `fontSize`: overrides font-size of selected segment text - `fontFamily`: overrides font-family of selected segment text +- `fontWeight`: overrides font-weight of selected segment text ## Maintainers diff --git a/js/SegmentedControlTab.js b/js/SegmentedControlTab.js index 85c1c7a1..ea6f3314 100644 --- a/js/SegmentedControlTab.js +++ b/js/SegmentedControlTab.js @@ -45,12 +45,13 @@ export const SegmentedControlTab = ({ }: Props): React.Node => { const colorSchemeHook = useColorScheme(); const colorScheme = appearance || colorSchemeHook; - const {color: textColor, fontSize, fontFamily} = fontStyle; + const {color: textColor, fontSize, fontFamily, fontWeight} = fontStyle; const { color: activeColor, fontSize: activeFontSize, fontFamily: activeFontFamily, + fontWeight: activeFontWeight, } = activeFontStyle; const getColor = () => { @@ -69,12 +70,14 @@ export const SegmentedControlTab = ({ fontFamily: activeFontFamily || fontFamily, fontSize: activeFontSize || fontSize, color: activeColor || color, + fontWeight: activeFontWeight || fontWeight || styles.activeText.fontWeight, }; const idleStyle = { color, fontSize: fontSize, fontFamily: fontFamily, + fontWeight: fontWeight, }; return ( diff --git a/js/types.js b/js/types.js index 1629a6d8..de716f9c 100644 --- a/js/types.js +++ b/js/types.js @@ -26,6 +26,21 @@ export type FontStyle = $ReadOnly<{| * Font Family of the Segmented Control */ fontFamily?: string, + /** + * Font Weight of the Segmented Control + */ + fontWeight?: + | 'normal' + | 'bold' + | '100' + | '200' + | '300' + | '400' + | '500' + | '600' + | '700' + | '800' + | '900', |}>; export type SegmentedControlProps = $ReadOnly<{|