diff --git a/Libraries/Text/RCTShadowText.h b/Libraries/Text/RCTShadowText.h index 0a0a63d3c5321c..5d793916bb1d10 100644 --- a/Libraries/Text/RCTShadowText.h +++ b/Libraries/Text/RCTShadowText.h @@ -23,7 +23,6 @@ extern NSString *const RCTReactTagAttributeName; @property (nonatomic, assign) BOOL isHighlighted; @property (nonatomic, assign) CGFloat letterSpacing; @property (nonatomic, assign) CGFloat lineHeight; -@property (nonatomic, assign) NSLineBreakMode lineBreakMode; @property (nonatomic, assign) NSUInteger numberOfLines; @property (nonatomic, assign) CGSize shadowOffset; @property (nonatomic, assign) NSTextAlignment textAlign; diff --git a/Libraries/Text/RCTShadowText.m b/Libraries/Text/RCTShadowText.m index bf42ab2865a7b0..a3286a88b332d8 100644 --- a/Libraries/Text/RCTShadowText.m +++ b/Libraries/Text/RCTShadowText.m @@ -119,7 +119,7 @@ - (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width NSTextContainer *textContainer = [NSTextContainer new]; textContainer.lineFragmentPadding = 0.0; - textContainer.lineBreakMode = _lineBreakMode; + textContainer.lineBreakMode = _numberOfLines > 0 ? NSLineBreakByTruncatingTail : NSLineBreakByClipping; textContainer.maximumNumberOfLines = _numberOfLines; textContainer.size = (CGSize){isnan(width) ? CGFLOAT_MAX : width, CGFLOAT_MAX}; @@ -370,7 +370,6 @@ - (void)set##setProp:(type)value; \ RCT_TEXT_PROPERTY(IsHighlighted, _isHighlighted, BOOL) RCT_TEXT_PROPERTY(LetterSpacing, _letterSpacing, CGFloat) RCT_TEXT_PROPERTY(LineHeight, _lineHeight, CGFloat) -RCT_TEXT_PROPERTY(LineBreakMode, _lineBreakMode, NSLineBreakMode) RCT_TEXT_PROPERTY(NumberOfLines, _numberOfLines, NSUInteger) RCT_TEXT_PROPERTY(TextAlign, _textAlign, NSTextAlignment) RCT_TEXT_PROPERTY(TextDecorationColor, _textDecorationColor, UIColor *); diff --git a/Libraries/Text/RCTTextManager.m b/Libraries/Text/RCTTextManager.m index d005f71e2a1a06..2a7e4d98b47275 100644 --- a/Libraries/Text/RCTTextManager.m +++ b/Libraries/Text/RCTTextManager.m @@ -50,7 +50,6 @@ - (RCTShadowView *)shadowView RCT_EXPORT_SHADOW_PROPERTY(isHighlighted, BOOL) RCT_EXPORT_SHADOW_PROPERTY(letterSpacing, CGFloat) RCT_EXPORT_SHADOW_PROPERTY(lineHeight, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(lineBreakMode, NSLineBreakMode) RCT_EXPORT_SHADOW_PROPERTY(numberOfLines, NSUInteger) RCT_EXPORT_SHADOW_PROPERTY(textAlign, NSTextAlignment) RCT_EXPORT_SHADOW_PROPERTY(textDecorationStyle, NSUnderlineStyle) diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 7ef0e55d22503f..eeb88c2dd2d3c7 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -219,18 +219,6 @@ const Text = React.createClass({ isHighlighted: this.state.isHighlighted, }; } - if (Platform.OS === 'ios' && newProps.lineBreakMode === undefined) { - // Prevent mutation of `this.props`! - if (newProps === this.props) { - newProps = { ...this.props }; - } - // If `numberOfLines` is undefined, it defaults to 0 in native code. - if (newProps.numberOfLines !== undefined && newProps.numberOfLines > 0) { - newProps.lineBreakMode = 'truncating-tail'; - } else { - newProps.lineBreakMode = 'clipping'; - } - } if (this.context.isInAParentText) { return ; } else { diff --git a/Libraries/Text/TextStylePropTypes.js b/Libraries/Text/TextStylePropTypes.js index dd37615b5d7921..9c4668174e4f8e 100644 --- a/Libraries/Text/TextStylePropTypes.js +++ b/Libraries/Text/TextStylePropTypes.js @@ -40,17 +40,6 @@ var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), { */ letterSpacing: ReactPropTypes.number, lineHeight: ReactPropTypes.number, - /** - * @platform ios - */ - lineBreakMode: ReactPropTypes.oneOf([ - 'clipping', - 'word-wrapping', - 'char-wrapping', - 'truncating-head', - 'truncating-middle', - 'truncating-tail', - ]), /** * Specifies text alignment. The value 'justify' is only supported on iOS. */ diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index fde74e2bae7104..ebdbee02a5847d 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -231,12 +231,12 @@ + (NSDate *)NSDate:(id)json } RCT_ENUM_CONVERTER(NSLineBreakMode, (@{ + @"wordWrapping": @(NSLineBreakByWordWrapping), + @"charWrapping": @(NSLineBreakByCharWrapping), @"clipping": @(NSLineBreakByClipping), - @"word-wrapping": @(NSLineBreakByWordWrapping), - @"char-wrapping": @(NSLineBreakByCharWrapping), - @"truncating-head": @(NSLineBreakByTruncatingHead), - @"truncating-middle": @(NSLineBreakByTruncatingMiddle), - @"truncating-tail": @(NSLineBreakByTruncatingTail), + @"truncatingHead": @(NSLineBreakByTruncatingHead), + @"truncatingTail": @(NSLineBreakByTruncatingTail), + @"truncatingMiddle": @(NSLineBreakByTruncatingMiddle), }), NSLineBreakByWordWrapping, integerValue) RCT_ENUM_CONVERTER(NSTextAlignment, (@{