Skip to content

Commit

Permalink
Adds clip ellipsize mode support on Android
Browse files Browse the repository at this point in the history
Fixes #18474

Summary:

This allows use clip as ellipsize mode for truncated text on android
  • Loading branch information
t4deu committed Mar 25, 2018
1 parent 1acef45 commit e77a173
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RNTester/js/TextExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ class TextExample extends React.Component<{}> {
<Text ellipsizeMode="head" numberOfLines={1}>
This very long text should be truncated with dots in the beginning.
</Text>
<Text ellipsizeMode="clip" numberOfLines={1}>
This very long text should be clipped and this will not be visible.
</Text>
</RNTesterBlock>
<RNTesterBlock title="Include Font Padding">
<View style={{flexDirection: 'row', justifyContent: 'space-around', marginBottom: 10}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void setEllipsizeMode(ReactTextView view, @Nullable String ellipsizeMode)
view.setEllipsizeLocation(TextUtils.TruncateAt.START);
} else if (ellipsizeMode.equals("middle")) {
view.setEllipsizeLocation(TextUtils.TruncateAt.MIDDLE);
} else if (ellipsizeMode.equals("clip")) {
view.setEllipsizeLocation(null);
} else {
throw new JSApplicationIllegalArgumentException("Invalid ellipsizeMode: " + ellipsizeMode);
}
Expand Down

0 comments on commit e77a173

Please sign in to comment.