Skip to content

Commit c5d1ae0

Browse files
skv-headlessgrabbou
authored andcommitted
change lineBreakMode to ellipsizeMode
Summary: lineBreakMode only in rc so I think we can replace property without any deprecation warnings. satya164 Closes #9008 Differential Revision: D3614901 fbshipit-source-id: 724227c0a89192825a24850b930b80884571a51f
1 parent a6d0f27 commit c5d1ae0

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

Examples/UIExplorer/js/TextExample.android.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,14 @@ var TextExample = React.createClass({
400400
Demo text shadow
401401
</Text>
402402
</UIExplorerBlock>
403-
<UIExplorerBlock title="Line break mode">
403+
<UIExplorerBlock title="Ellipsize mode">
404404
<Text numberOfLines={1}>
405405
This very long text should be truncated with dots in the end.
406406
</Text>
407-
<Text lineBreakMode="middle" numberOfLines={1}>
407+
<Text ellipsizeMode="middle" numberOfLines={1}>
408408
This very long text should be truncated with dots in the middle.
409409
</Text>
410-
<Text lineBreakMode="head" numberOfLines={1}>
410+
<Text ellipsizeMode="head" numberOfLines={1}>
411411
This very long text should be truncated with dots in the beginning.
412412
</Text>
413413
</UIExplorerBlock>

Examples/UIExplorer/js/TextExample.ios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,20 +445,20 @@ exports.examples = [
445445
);
446446
},
447447
}, {
448-
title: 'Line break mode',
448+
title: 'Ellipsize mode',
449449
render: function() {
450450
return (
451451
<View>
452452
<Text numberOfLines={1}>
453453
This very long text should be truncated with dots in the end.
454454
</Text>
455-
<Text lineBreakMode="middle" numberOfLines={1}>
455+
<Text ellipsizeMode="middle" numberOfLines={1}>
456456
This very long text should be truncated with dots in the middle.
457457
</Text>
458-
<Text lineBreakMode="head" numberOfLines={1}>
458+
<Text ellipsizeMode="head" numberOfLines={1}>
459459
This very long text should be truncated with dots in the beginning.
460460
</Text>
461-
<Text lineBreakMode="clip" numberOfLines={1}>
461+
<Text ellipsizeMode="clip" numberOfLines={1}>
462462
This very looooooooooooooooooooooooooooong text should be clipped.
463463
</Text>
464464
</View>

Libraries/Text/RCTShadowText.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern NSString *const RCTReactTagAttributeName;
2424
@property (nonatomic, assign) CGFloat letterSpacing;
2525
@property (nonatomic, assign) CGFloat lineHeight;
2626
@property (nonatomic, assign) NSUInteger numberOfLines;
27-
@property (nonatomic, assign) NSLineBreakMode lineBreakMode;
27+
@property (nonatomic, assign) NSLineBreakMode ellipsizeMode;
2828
@property (nonatomic, assign) CGSize shadowOffset;
2929
@property (nonatomic, assign) NSTextAlignment textAlign;
3030
@property (nonatomic, assign) NSWritingDirection writingDirection;

Libraries/Text/RCTShadowText.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ - (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasure
190190
textContainer.lineFragmentPadding = 0.0;
191191

192192
if (_numberOfLines > 0) {
193-
textContainer.lineBreakMode = _lineBreakMode;
193+
textContainer.lineBreakMode = _ellipsizeMode;
194194
} else {
195195
textContainer.lineBreakMode = NSLineBreakByClipping;
196196
}
@@ -470,7 +470,7 @@ - (void)set##setProp:(type)value; \
470470
RCT_TEXT_PROPERTY(LetterSpacing, _letterSpacing, CGFloat)
471471
RCT_TEXT_PROPERTY(LineHeight, _lineHeight, CGFloat)
472472
RCT_TEXT_PROPERTY(NumberOfLines, _numberOfLines, NSUInteger)
473-
RCT_TEXT_PROPERTY(LineBreakMode, _lineBreakMode, NSLineBreakMode)
473+
RCT_TEXT_PROPERTY(EllipsizeMode, _ellipsizeMode, NSLineBreakMode)
474474
RCT_TEXT_PROPERTY(TextAlign, _textAlign, NSTextAlignment)
475475
RCT_TEXT_PROPERTY(TextDecorationColor, _textDecorationColor, UIColor *);
476476
RCT_TEXT_PROPERTY(TextDecorationLine, _textDecorationLine, RCTTextDecorationLineType);

Libraries/Text/RCTTextManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ - (RCTShadowView *)shadowView
6464
RCT_EXPORT_SHADOW_PROPERTY(letterSpacing, CGFloat)
6565
RCT_EXPORT_SHADOW_PROPERTY(lineHeight, CGFloat)
6666
RCT_EXPORT_SHADOW_PROPERTY(numberOfLines, NSUInteger)
67-
RCT_EXPORT_SHADOW_PROPERTY(lineBreakMode, NSLineBreakMode)
67+
RCT_EXPORT_SHADOW_PROPERTY(ellipsizeMode, NSLineBreakMode)
6868
RCT_EXPORT_SHADOW_PROPERTY(textAlign, NSTextAlignment)
6969
RCT_EXPORT_SHADOW_PROPERTY(textDecorationStyle, NSUnderlineStyle)
7070
RCT_EXPORT_SHADOW_PROPERTY(textDecorationColor, UIColor)

Libraries/Text/Text.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const viewConfig = {
2929
validAttributes: merge(ReactNativeViewAttributes.UIView, {
3030
isHighlighted: true,
3131
numberOfLines: true,
32-
lineBreakMode: true,
32+
ellipsizeMode: true,
3333
allowFontScaling: true,
3434
selectable: true,
3535
}),
@@ -90,7 +90,7 @@ const viewConfig = {
9090
const Text = React.createClass({
9191
propTypes: {
9292
/**
93-
* Line Break mode. This can be one of the following values:
93+
* This can be one of the following values:
9494
*
9595
* - `head` - The line is displayed so that the end fits in the container and the missing text
9696
* at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
@@ -106,13 +106,13 @@ const Text = React.createClass({
106106
*
107107
* > `clip` is working only for iOS
108108
*/
109-
lineBreakMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
109+
ellipsizeMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
110110
/**
111111
* Used to truncate the text with an ellipsis after computing the text
112112
* layout, including line wrapping, such that the total number of lines
113113
* does not exceed this number.
114114
*
115-
* This prop is commonly used with `lineBreakMode`.
115+
* This prop is commonly used with `ellipsizeMode`.
116116
*/
117117
numberOfLines: React.PropTypes.number,
118118
/**
@@ -172,7 +172,7 @@ const Text = React.createClass({
172172
return {
173173
accessible: true,
174174
allowFontScaling: true,
175-
lineBreakMode: 'tail',
175+
ellipsizeMode: 'tail',
176176
};
177177
},
178178
getInitialState: function(): Object {

ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class ViewProps {
7272
public static final String LINE_HEIGHT = "lineHeight";
7373
public static final String NEEDS_OFFSCREEN_ALPHA_COMPOSITING = "needsOffscreenAlphaCompositing";
7474
public static final String NUMBER_OF_LINES = "numberOfLines";
75-
public static final String LINE_BREAK_MODE = "lineBreakMode";
75+
public static final String LINE_BREAK_MODE = "ellipsizeMode";
7676
public static final String ON = "on";
7777
public static final String RESIZE_MODE = "resizeMode";
7878
public static final String TEXT_ALIGN = "textAlign";

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ public void setTextAlign(ReactTextView view, @Nullable String textAlign) {
7474
}
7575

7676
@ReactProp(name = ViewProps.LINE_BREAK_MODE)
77-
public void setLineBreakMode(ReactTextView view, @Nullable String lineBreakMode) {
78-
if(lineBreakMode == null) {
77+
public void setLineBreakMode(ReactTextView view, @Nullable String ellipsizeMode) {
78+
if(ellipsizeMode == null) {
7979
return;
8080
}
8181

82-
if (lineBreakMode.equals("head")) {
82+
if (ellipsizeMode.equals("head")) {
8383
view.setEllipsize(TextUtils.TruncateAt.START);
84-
} else if (lineBreakMode.equals("middle")) {
84+
} else if (ellipsizeMode.equals("middle")) {
8585
view.setEllipsize(TextUtils.TruncateAt.MIDDLE);
86-
} else if (lineBreakMode.equals("tail")) {
86+
} else if (ellipsizeMode.equals("tail")) {
8787
view.setEllipsize(TextUtils.TruncateAt.END);
8888
}
8989
}

0 commit comments

Comments
 (0)