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
54 changes: 0 additions & 54 deletions src/components/TextWithEllipsis/index.js

This file was deleted.

43 changes: 43 additions & 0 deletions src/components/TextWithEllipsis/index.tsx
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;