line break mode for ios

Summary:
What do you think is ```lineBreakMode``` a good name? For android it is called ```ellipsize```.

<img src="https://cloud.githubusercontent.com/assets/1488195/15628555/7372f8d0-250c-11e6-8919-722f28a38d60.png"" width="300" />
Closes https://github.com/facebook/react-native/pull/7819

Differential Revision: D3417256

fbshipit-source-id: 189441a23ff554bf7f6d67fa8510959351e9e5cc
This commit is contained in:
Sokovikov
2016-06-10 04:26:45 -07:00
committed by Facebook Github Bot 3
parent 33dfc9db92
commit c03b166854
9 changed files with 70 additions and 8 deletions

View File

@@ -67,6 +67,7 @@ public class ViewProps {
public static final String LINE_HEIGHT = "lineHeight";
public static final String NEEDS_OFFSCREEN_ALPHA_COMPOSITING = "needsOffscreenAlphaCompositing";
public static final String NUMBER_OF_LINES = "numberOfLines";
public static final String LINE_BREAK_MODE = "lineBreakMode";
public static final String ON = "on";
public static final String RESIZE_MODE = "resizeMode";
public static final String TEXT_ALIGN = "textAlign";

View File

@@ -73,6 +73,21 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
}
}
@ReactProp(name = ViewProps.LINE_BREAK_MODE)
public void setLineBreakMode(ReactTextView view, @Nullable String lineBreakMode) {
if(lineBreakMode == null) {
return;
}
if (lineBreakMode.equals("head")) {
view.setEllipsize(TextUtils.TruncateAt.START);
} else if (lineBreakMode.equals("middle")) {
view.setEllipsize(TextUtils.TruncateAt.MIDDLE);
} else if (lineBreakMode.equals("tail")) {
view.setEllipsize(TextUtils.TruncateAt.END);
}
}
@ReactProp(name = ViewProps.TEXT_ALIGN_VERTICAL)
public void setTextAlignVertical(ReactTextView view, @Nullable String textAlignVertical) {
if (textAlignVertical == null || "auto".equals(textAlignVertical)) {