-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30202 from software-mansion-labs/ts-migration/Tex…
…tWithEllipsis [TS migration] Migrate TextWithEllipsis
- Loading branch information
Showing
2 changed files
with
43 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; | ||
import Text from '@components/Text'; | ||
import styles from '@styles/styles'; | ||
|
||
type TextWithEllipsisProps = { | ||
/** Leading text before the ellipsis */ | ||
leadingText: string; | ||
|
||
/** Text after the ellipsis */ | ||
trailingText: string; | ||
|
||
/** Styles for leading and trailing text */ | ||
textStyle?: StyleProp<TextStyle>; | ||
|
||
/** Styles for leading text View */ | ||
leadingTextParentStyle?: StyleProp<ViewStyle>; | ||
|
||
/** Styles for parent View */ | ||
wrapperStyle?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
function TextWithEllipsis({leadingText, trailingText, textStyle, leadingTextParentStyle, wrapperStyle}: TextWithEllipsisProps) { | ||
return ( | ||
<View style={[styles.flexRow, wrapperStyle]}> | ||
<View style={[styles.flexShrink1, leadingTextParentStyle]}> | ||
<Text | ||
style={textStyle} | ||
numberOfLines={1} | ||
> | ||
{leadingText} | ||
</Text> | ||
</View> | ||
<View style={styles.flexShrink0}> | ||
<Text style={textStyle}>{trailingText}</Text> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
TextWithEllipsis.displayName = 'TextWithEllipsis'; | ||
|
||
export default TextWithEllipsis; |