Skip to content

Commit

Permalink
Resolve parent cornerRadius only when clipped (#6714)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored Oct 25, 2020
1 parent df745fe commit 9f16af5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/ios/RNNViewLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ - (instancetype)initWithFromElement:(UIView *)fromElement toElement:(UIView *)to
self.fromAngle = [self getViewAngle:fromElement];
self.toAngle = [self getViewAngle:toElement];
self.fromTransform = [self getTransform:fromElement];
;
self.toTransform = [self getTransform:toElement];
self.toBounds = toElement.layer.bounds;
self.fromBounds = fromElement.layer.bounds;
self.fromCornerRadius = [self getCornerRadius:fromElement];
self.toCornerRadius = [self getCornerRadius:toElement];
self.fromCornerRadius = fromElement.layer.cornerRadius ?: [self getClippedCornerRadius:fromElement];
self.toCornerRadius = toElement.layer.cornerRadius ?: [self getClippedCornerRadius:toElement];
return self;
}

- (CGFloat)getCornerRadius:(UIView *)view {
if (view.layer.cornerRadius > 0) {
- (CGFloat)getClippedCornerRadius:(UIView *)view {
if (view.layer.cornerRadius > 0 && view.clipsToBounds) {
return view.layer.cornerRadius;
} else if (CGRectEqualToRect(view.frame, view.superview.bounds)) {
return [self getCornerRadius:view.superview];
return [self getClippedCornerRadius:view.superview];
}

return 0;
Expand Down

0 comments on commit 9f16af5

Please sign in to comment.