diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 17d40fb035..429cd745ca 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -129,6 +129,10 @@ export type Props = $Omit, 'mode'> & { * Sets additional distance outside of element in which a press can be detected. */ hitSlop?: TouchableRippleProps['hitSlop']; + /** + * Label text number Of Lines of the button. + */ + numberOfLines?: number; style?: Animated.WithAnimatedValue>; /** * Style for the button text. @@ -185,6 +189,7 @@ const Button = ( onPressOut, onLongPress, delayLongPress, + numberOfLines, style, theme: themeOverrides, uppercase: uppercaseProp, @@ -269,6 +274,19 @@ const Button = ( const borderRadius = theme.shapes.corner.largeIncreased; const iconSize = 18; + const NumberOfLines = numberOfLines ? numberOfLines : 1; + + const { backgroundColor, borderColor, textColor, borderWidth } = + getButtonColors({ + customButtonColor, + customTextColor, + theme, + mode, + disabled, + dark, + }); + const borderRadius = theme.shapes.corner.largeIncreased; + const iconSize = 18; const { backgroundColor, @@ -400,7 +418,7 @@ const Button = ( - + ) : null} diff --git a/src/components/SegmentedButtons/SegmentedButtons.tsx b/src/components/SegmentedButtons/SegmentedButtons.tsx index bdc4a70f89..7ac2c9ea70 100644 --- a/src/components/SegmentedButtons/SegmentedButtons.tsx +++ b/src/components/SegmentedButtons/SegmentedButtons.tsx @@ -52,6 +52,7 @@ export type Props = { * - `icon`: icon to display for the item * - `disabled`: whether the button is disabled * - `accessibilityLabel`: acccessibility label for the button. This is read by the screen reader when the user taps the button. + * - `numberOfLines`: label text number of lines of the button * - `checkedColor`: custom color for checked Text and Icon * - `uncheckedColor`: custom color for unchecked Text and Icon * - `onPress`: callback that is called when button is pressed @@ -65,6 +66,7 @@ export type Props = { icon?: IconSource; disabled?: boolean; accessibilityLabel?: string; + numberOfLines?: number; checkedColor?: string; uncheckedColor?: string; onPress?: (event: GestureResponderEvent) => void; @@ -78,6 +80,7 @@ export type Props = { * Density is applied to the height, to allow usage in denser UIs */ density?: 'regular' | 'small' | 'medium' | 'high'; + animated?: boolean; style?: StyleProp; theme?: ThemeProp; } & ConditionalValue; @@ -131,6 +134,7 @@ const SegmentedButtons = ({ buttons, multiSelect, density, + animated, style, theme: themeOverrides, }: Props) => { @@ -171,6 +175,7 @@ const SegmentedButtons = ({ {...item} key={i} checked={checked} + animated={animated} segment={segment} density={density} onPress={onPress}