Skip to content

Commit

Permalink
Use ellipsizeMode tail for Board
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed May 4, 2019
1 parent b5d4ffc commit 1ce98d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/AssignmentBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const AssignmentBoard: FunctionComponent<
getExtension(attachmentName)!
)
}
ellipsizeMode="tail"
>
{attachmentName}
</TextButton>
Expand Down Expand Up @@ -139,6 +140,7 @@ const AssignmentBoard: FunctionComponent<
getExtension(submittedAttachmentName)!
)
}
ellipsizeMode="tail"
>
{submittedAttachmentName}
</TextButton>
Expand Down
1 change: 1 addition & 0 deletions src/components/NoticeBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const NoticeBoard: FunctionComponent<
getExtension(attachmentName)!
)
}
ellipsizeMode="tail"
>
{attachmentName}
</TextButton>
Expand Down
5 changes: 3 additions & 2 deletions src/components/TextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import Colors from "../constants/Colors";
export type ITextButtonProps = TouchableOpacityProps & {
readonly textStyle?: TextProps["style"];
readonly children: string;
readonly ellipsizeMode?: TextProps["ellipsizeMode"];
};

class TextButton extends React.Component<ITextButtonProps> {
public render(): React.ReactElement {
const { textStyle, children } = this.props;
const { textStyle, children, ellipsizeMode } = this.props;
return (
<TouchableOpacity activeOpacity={Colors.activeOpacity} {...this.props}>
<Text
Expand All @@ -24,7 +25,7 @@ class TextButton extends React.Component<ITextButtonProps> {
textStyle
]}
numberOfLines={1}
ellipsizeMode="clip"
ellipsizeMode={ellipsizeMode || "clip"}
>
{children}
</Text>
Expand Down

0 comments on commit 1ce98d0

Please sign in to comment.