Skip to content
This repository has been archived by the owner on Feb 18, 2019. It is now read-only.

Commit

Permalink
backout (and remove) props.lineBreakMode from Text
Browse files Browse the repository at this point in the history
Reviewed By: jingc

Differential Revision: D3063164

fb-gh-sync-id: 81776866c09bb06411b9660f1f4833ba515e046a
shipit-source-id: 81776866c09bb06411b9660f1f4833ba515e046a
  • Loading branch information
Michelle Hwang authored and Facebook Github Bot 9 committed Mar 17, 2016
1 parent 3dbf9b9 commit 1455506
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
1 change: 0 additions & 1 deletion Libraries/Text/RCTShadowText.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Text/RCTShadowText.m
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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 *);
Expand Down
1 change: 0 additions & 1 deletion Libraries/Text/RCTTextManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <RCTVirtualText {...newProps} />;
} else {
Expand Down
11 changes: 0 additions & 11 deletions Libraries/Text/TextStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
10 changes: 5 additions & 5 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -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, (@{
Expand Down

0 comments on commit 1455506

Please sign in to comment.