@@ -27,6 +27,7 @@ - (instancetype)init
2727 _maxFontSizeMultiplier = NAN;
2828 _alignment = NSTextAlignmentNatural;
2929 _baseWritingDirection = NSWritingDirectionNatural;
30+ _lineBreakStrategy = NSLineBreakStrategyNone;
3031 _textShadowRadius = NAN;
3132 _opacity = NAN;
3233 _textTransform = RCTTextTransformUndefined;
@@ -61,6 +62,7 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes
6162 _lineHeight = !isnan (textAttributes->_lineHeight ) ? textAttributes->_lineHeight : _lineHeight;
6263 _alignment = textAttributes->_alignment != NSTextAlignmentNatural ? textAttributes->_alignment : _alignment; // *
6364 _baseWritingDirection = textAttributes->_baseWritingDirection != NSWritingDirectionNatural ? textAttributes->_baseWritingDirection : _baseWritingDirection; // *
65+ _lineBreakStrategy = textAttributes->_lineBreakStrategy != NSLineBreakStrategyNone ? textAttributes->_lineBreakStrategy : _lineBreakStrategy;
6466
6567 // Decoration
6668 _textDecorationColor = textAttributes->_textDecorationColor ?: _textDecorationColor;
@@ -93,27 +95,34 @@ - (NSParagraphStyle *)effectiveParagraphStyle
9395 alignment = NSTextAlignmentRight;
9496 }
9597 }
96-
98+
9799 paragraphStyle.alignment = alignment;
98100 isParagraphStyleUsed = YES ;
99101 }
100-
102+
101103 if (_baseWritingDirection != NSWritingDirectionNatural) {
102104 paragraphStyle.baseWritingDirection = _baseWritingDirection;
103105 isParagraphStyleUsed = YES ;
104106 }
105-
107+
108+ if (_lineBreakStrategy != NSLineBreakStrategyNone) {
109+ if (@available (iOS 14.0 , *)) {
110+ paragraphStyle.lineBreakStrategy = _lineBreakStrategy;
111+ isParagraphStyleUsed = YES ;
112+ }
113+ }
114+
106115 if (!isnan (_lineHeight)) {
107116 CGFloat lineHeight = _lineHeight * self.effectiveFontSizeMultiplier ;
108117 paragraphStyle.minimumLineHeight = lineHeight;
109118 paragraphStyle.maximumLineHeight = lineHeight;
110119 isParagraphStyleUsed = YES ;
111120 }
112-
121+
113122 if (isParagraphStyleUsed) {
114123 return [paragraphStyle copy ];
115124 }
116-
125+
117126 return nil ;
118127}
119128
@@ -294,6 +303,7 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes
294303 RCTTextAttributesCompareFloats (_lineHeight) &&
295304 RCTTextAttributesCompareFloats (_alignment) &&
296305 RCTTextAttributesCompareOthers (_baseWritingDirection) &&
306+ RCTTextAttributesCompareOthers (_lineBreakStrategy) &&
297307 // Decoration
298308 RCTTextAttributesCompareObjects (_textDecorationColor) &&
299309 RCTTextAttributesCompareOthers (_textDecorationStyle) &&
0 commit comments