From 870bc4807a8c3f90498cf4c2ed3c030cb7b43ef9 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 8 Jan 2018 14:43:18 -0800 Subject: [PATCH] Yoga float vs. CoreGraphics float in RCTWrapper Summary: See RCTYogaFloatFromCoreGraphicsFloat for more details. Differential Revision: D6677092 fbshipit-source-id: ca1b2634c903277f529c57557055760a9bf48f28 --- Libraries/Wrapper/RCTWrapperShadowView.m | 9 +++++++-- Libraries/Wrapper/RCTWrapperView.m | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Libraries/Wrapper/RCTWrapperShadowView.m b/Libraries/Wrapper/RCTWrapperShadowView.m index c619d0e4c..723ead617 100644 --- a/Libraries/Wrapper/RCTWrapperShadowView.m +++ b/Libraries/Wrapper/RCTWrapperShadowView.m @@ -4,6 +4,7 @@ #import #import +#import #import "RCTWrapperView.h" @@ -27,7 +28,7 @@ static YGSize RCTWrapperShadowViewMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { CGSize minimumSize = CGSizeMake(0, 0); - CGSize maximumSize = CGSizeMake(INFINITY, INFINITY); + CGSize maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); switch (widthMode) { case YGMeasureModeUndefined: @@ -55,7 +56,11 @@ static YGSize RCTWrapperShadowViewMeasure(YGNodeRef node, float width, YGMeasure RCTWrapperShadowView *shadowView = (__bridge RCTWrapperShadowView *)YGNodeGetContext(node); CGSize size = [shadowView measureWithMinimumSize:minimumSize maximumSize:maximumSize]; - return (YGSize){size.width, size.height}; + + return (YGSize){ + RCTYogaFloatFromCoreGraphicsFloat(size.width), + RCTYogaFloatFromCoreGraphicsFloat(size.height) + }; } - (CGSize)measureWithMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize diff --git a/Libraries/Wrapper/RCTWrapperView.m b/Libraries/Wrapper/RCTWrapperView.m index c690be482..9843c1283 100644 --- a/Libraries/Wrapper/RCTWrapperView.m +++ b/Libraries/Wrapper/RCTWrapperView.m @@ -77,7 +77,7 @@ - (CGSize)intrinsicContentSize { - return [self sizeThatFits:CGSizeMake(INFINITY, INFINITY)]; + return [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; } - (CGSize)sizeThatFits:(CGSize)size