Skip to content

Commit

Permalink
Introduced -[RCTShadowView contentFrame]
Browse files Browse the repository at this point in the history
Summary:
Another trivial sugar/helper to access computed by Yoga layout metrics.
We will use it soon in the new Text render/layout engine.

Reviewed By: mmmulani

Differential Revision: D6671979

fbshipit-source-id: d36933415c2fa50bae5cc171434d8f0b281955b7
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 16, 2018
1 parent 193a2bd commit 6882132
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions React/Views/RCTShadowView+Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ RCT_EXTERN CGFloat RCTCoreGraphicsFloatFromYogaFloat(float value);
@property (nonatomic, readonly) UIEdgeInsets borderAsInsets;
@property (nonatomic, readonly) UIEdgeInsets compoundInsets;
@property (nonatomic, readonly) CGSize availableSize;
@property (nonatomic, readonly) CGRect contentFrame;

#pragma mark - Measuring

Expand Down
6 changes: 6 additions & 0 deletions React/Views/RCTShadowView+Layout.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ - (CGSize)availableSize
return UIEdgeInsetsInsetRect((CGRect){CGPointZero, self.frame.size}, self.compoundInsets).size;
}

- (CGRect)contentFrame
{
CGRect bounds = (CGRect){CGPointZero, self.frame.size};
return UIEdgeInsetsInsetRect(bounds, self.compoundInsets);
}

#pragma mark - Measuring

- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize
Expand Down

0 comments on commit 6882132

Please sign in to comment.