Corrected computation of RCText element height with padding

Summary: Corrected computation of RCText element height with padding (padding was counted twice).
See also issue #2466.
Closes https://github.com/facebook/react-native/pull/2838

Reviewed By: @​svcscm

Differential Revision: D2535924

Pulled By: @nicklockwood

fb-gh-sync-id: b9527803c0a5a6eed1db7e37c98b628750ab2045
This commit is contained in:
Quentin Adam 2015-10-13 06:17:07 -07:00 коммит произвёл facebook-github-bot-7
Родитель 5b425278bb
Коммит c73ceff914
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -86,7 +86,10 @@ static css_dim_t RCTMeasure(void *context, float width)
parentProperties = [super processUpdatedProperties:applierBlocks
parentProperties:parentProperties];
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width];
UIEdgeInsets padding = self.paddingAsInsets;
CGFloat width = self.frame.size.width - (padding.left + padding.right);
NSTextStorage *textStorage = [self buildTextStorageForWidth:width];
[applierBlocks addObject:^(RCTSparseArray *viewRegistry) {
RCTText *view = viewRegistry[self.reactTag];
view.textStorage = textStorage;
@ -105,9 +108,6 @@ static css_dim_t RCTMeasure(void *context, float width)
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width
{
UIEdgeInsets padding = self.paddingAsInsets;
width -= (padding.left + padding.right);
if (_cachedTextStorage && width == _cachedTextStorageWidth) {
return _cachedTextStorage;
}