Skip to content

Commit

Permalink
Update Button.tsx
Browse files Browse the repository at this point in the history
Label text number Of Lines of the button.
  • Loading branch information
aravind3566 authored Nov 19, 2024
1 parent e57f88c commit a8242c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
* Specifies the largest possible scale a text font can reach.
*/
maxFontSizeMultiplier?: number;
/**
* Label text number Of Lines of the button.
*/
noOfLines?: number;
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
/**
* Style for the button text.
Expand Down Expand Up @@ -186,6 +190,7 @@ const Button = (
onPressOut,
onLongPress,
delayLongPress,
noOfLines,
style,
theme: themeOverrides,
uppercase: uppercaseProp,
Expand Down Expand Up @@ -266,6 +271,7 @@ const Button = (

const borderRadius = (isV3 ? 5 : 1) * roundness;
const iconSize = isV3 ? 18 : 16;
const numberOfLines = noOfLines ? 1 : noOfLines;

const { backgroundColor, borderColor, textColor, borderWidth } =
getButtonColors({
Expand Down Expand Up @@ -383,7 +389,7 @@ const Button = (
<Text
variant="labelLarge"
selectable={false}
numberOfLines={1}
numberOfLines={numberOfLines}
testID={`${testID}-text`}
style={[
styles.label,
Expand Down

0 comments on commit a8242c0

Please sign in to comment.