Skip to content

Commit

Permalink
'-[RCTSurfaceRootShadowView sizeThatFitsMinimumSize:]' was removed
Browse files Browse the repository at this point in the history
Summary: Because we already support this for all kinds of shadow views!

Reviewed By: mmmulani

Differential Revision: D6665636

fbshipit-source-id: ceee7e4952ede4bbe54aedde5545587a1d13ea5a
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 8, 2018
1 parent b2a2519 commit 176a578
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
1 change: 1 addition & 0 deletions React/Base/Surface/RCTSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "RCTAssert.h"
#import "RCTBridge+Private.h"
#import "RCTBridge.h"
#import "RCTShadowView+Layout.h"
#import "RCTSurfaceDelegate.h"
#import "RCTSurfaceRootShadowView.h"
#import "RCTSurfaceRootShadowViewDelegate.h"
Expand Down
3 changes: 0 additions & 3 deletions React/Base/Surface/RCTSurfaceRootShadowView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

@property (nonatomic, weak) id<RCTSurfaceRootShadowViewDelegate> delegate;

- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize
maximumSize:(CGSize)maximumSize;

/**
* Layout direction (LTR or RTL) inherited from native environment and
* is using as a base direction value in layout engine.
Expand Down
35 changes: 0 additions & 35 deletions React/Base/Surface/RCTSurfaceRootShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,6 @@ - (void)calculateLayoutWithMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)m
return viewsWithNewFrame;
}

- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize
maximumSize:(CGSize)maximumSize
{
// Positive case where requested constraind are aready enforced.
if (CGSizeEqualToSize(minimumSize, _minimumSize) &&
CGSizeEqualToSize(maximumSize, _maximumSize)) {
// We stil need to call `calculateLayoutWithMinimumSize:maximumSize`
// mehtod though.
[self calculateLayoutWithMinimumSize:_minimumSize
maximumSize:_maximumSize];

YGNodeRef yogaNode = self.yogaNode;
return CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode));
}

// Generic case, where requested constraind are different from enforced.

// Applying given size constraints.
[self calculateLayoutWithMinimumSize:minimumSize
maximumSize:maximumSize];

YGNodeRef yogaNode = self.yogaNode;
CGSize fittingSize =
CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode));

// Reverting size constraints.
[self calculateLayoutWithMinimumSize:_minimumSize
maximumSize:_maximumSize];

return CGSizeMake(
MAX(minimumSize.width, MIN(maximumSize.width, fittingSize.width)),
MAX(minimumSize.height, MIN(maximumSize.height, fittingSize.height))
);
}

- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize
{
if (CGSizeEqualToSize(minimumSize, _minimumSize) &&
Expand Down

0 comments on commit 176a578

Please sign in to comment.