mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 18:54:58 +00:00
Fixes #813
Summary: Also fix RCTShadowText export name. Closes https://github.com/facebook/react-native/pull/857 Github Author: "Dr. Kibitz" <info@drkibitz.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
parent
2bda21fbf0
commit
621a30c8b8
@ -22,15 +22,21 @@ static css_dim_t RCTMeasure(void *context, float width)
|
|||||||
RCTShadowText *shadowText = (__bridge RCTShadowText *)context;
|
RCTShadowText *shadowText = (__bridge RCTShadowText *)context;
|
||||||
|
|
||||||
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:[shadowText attributedString]];
|
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:[shadowText attributedString]];
|
||||||
|
NSTextStorage *previousTextStorage = shadowText.layoutManager.textStorage;
|
||||||
|
if (previousTextStorage) {
|
||||||
|
[previousTextStorage removeLayoutManager:shadowText.layoutManager];
|
||||||
|
}
|
||||||
[textStorage addLayoutManager:shadowText.layoutManager];
|
[textStorage addLayoutManager:shadowText.layoutManager];
|
||||||
|
|
||||||
shadowText.textContainer.size = CGSizeMake(isnan(width) ? CGFLOAT_MAX : width, CGFLOAT_MAX);
|
shadowText.textContainer.size = CGSizeMake(isnan(width) ? CGFLOAT_MAX : width, CGFLOAT_MAX);
|
||||||
shadowText.layoutManager.textStorage = textStorage;
|
|
||||||
[shadowText.layoutManager ensureLayoutForTextContainer:shadowText.textContainer];
|
[shadowText.layoutManager ensureLayoutForTextContainer:shadowText.textContainer];
|
||||||
|
|
||||||
CGSize computedSize = [shadowText.layoutManager usedRectForTextContainer:shadowText.textContainer].size;
|
CGSize computedSize = [shadowText.layoutManager usedRectForTextContainer:shadowText.textContainer].size;
|
||||||
|
|
||||||
[textStorage removeLayoutManager:shadowText.layoutManager];
|
[textStorage removeLayoutManager:shadowText.layoutManager];
|
||||||
|
if (previousTextStorage) {
|
||||||
|
[previousTextStorage addLayoutManager:shadowText.layoutManager];
|
||||||
|
}
|
||||||
|
|
||||||
css_dim_t result;
|
css_dim_t result;
|
||||||
result.dimensions[CSS_WIDTH] = RCTCeilPixelValue(computedSize.width);
|
result.dimensions[CSS_WIDTH] = RCTCeilPixelValue(computedSize.width);
|
||||||
|
@ -46,7 +46,7 @@ RCT_EXPORT_SHADOW_PROPERTY(fontWeight, NSString)
|
|||||||
RCT_EXPORT_SHADOW_PROPERTY(fontStyle, NSString)
|
RCT_EXPORT_SHADOW_PROPERTY(fontStyle, NSString)
|
||||||
RCT_EXPORT_SHADOW_PROPERTY(isHighlighted, BOOL)
|
RCT_EXPORT_SHADOW_PROPERTY(isHighlighted, BOOL)
|
||||||
RCT_EXPORT_SHADOW_PROPERTY(lineHeight, CGFloat)
|
RCT_EXPORT_SHADOW_PROPERTY(lineHeight, CGFloat)
|
||||||
RCT_EXPORT_SHADOW_PROPERTY(maxNumberOfLines, NSInteger)
|
RCT_EXPORT_SHADOW_PROPERTY(maximumNumberOfLines, NSInteger)
|
||||||
RCT_EXPORT_SHADOW_PROPERTY(shadowOffset, CGSize)
|
RCT_EXPORT_SHADOW_PROPERTY(shadowOffset, CGSize)
|
||||||
RCT_EXPORT_SHADOW_PROPERTY(textAlign, NSTextAlignment)
|
RCT_EXPORT_SHADOW_PROPERTY(textAlign, NSTextAlignment)
|
||||||
RCT_REMAP_SHADOW_PROPERTY(backgroundColor, textBackgroundColor, UIColor)
|
RCT_REMAP_SHADOW_PROPERTY(backgroundColor, textBackgroundColor, UIColor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user