Skip to content

Commit

Permalink
Yoga float vs. CoreGraphics float in RCTWrapper
Browse files Browse the repository at this point in the history
Summary: See RCTYogaFloatFromCoreGraphicsFloat for more details.

Differential Revision: D6677092

fbshipit-source-id: ca1b2634c903277f529c57557055760a9bf48f28
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 8, 2018
1 parent c756122 commit 870bc48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Libraries/Wrapper/RCTWrapperShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>
#import <React/RCTShadowView+Layout.h>

#import "RCTWrapperView.h"

Expand All @@ -27,7 +28,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Wrapper/RCTWrapperView.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (void)invalidateIntrinsicContentSize

- (CGSize)intrinsicContentSize
{
return [self sizeThatFits:CGSizeMake(INFINITY, INFINITY)];
return [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
}

- (CGSize)sizeThatFits:(CGSize)size
Expand Down

0 comments on commit 870bc48

Please sign in to comment.