Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ios/AnimatedReactView.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ - (void)hijackReactElement:(UIView *)element {
_originalFrame = _reactView.frame;
_originalTransform = element.layer.transform;
_originalLayoutBounds = element.layer.bounds;
self.contentMode = element.contentMode;
self.frame = self.location.fromFrame;
_originalParent = _reactView.superview;
_originalCornerRadius = element.layer.cornerRadius;
Expand Down
2 changes: 2 additions & 0 deletions lib/ios/RNNViewLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@property (nonatomic) CGRect toBounds;
@property (nonatomic) CGFloat fromAngle;
@property (nonatomic) CGFloat toAngle;
@property (nonatomic) CGFloat fromCornerRadius;
@property (nonatomic) CGFloat toCornerRadius;
@property (nonatomic) CATransform3D fromTransform;
@property (nonatomic) CATransform3D toTransform;

Expand Down
13 changes: 12 additions & 1 deletion lib/ios/RNNViewLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@ - (instancetype)initWithFromElement:(UIView *)fromElement toElement:(UIView *)to
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];
return self;
}

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

return 0;
}

- (CATransform3D)getTransform:(UIView *)view {
if (view) {
if (!CATransform3DEqualToTransform(view.layer.transform, CATransform3DIdentity)) {
Expand Down
5 changes: 2 additions & 3 deletions lib/ios/SharedElementAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ - (AnimatedReactView *)createAnimatedView:(SharedElementTransitionOptions *)tran
[animations addObject:[[TextStorageTransition alloc] initWithView:self.view from:((AnimatedTextView *)self.view).fromTextStorage to:((AnimatedTextView *)self.view).toTextStorage startDelay:startDelay duration:duration interpolation:interpolation]];
}

if (_fromView.layer.cornerRadius != _toView.layer.cornerRadius) {
if (self.view.location.fromCornerRadius != self.view.location.toCornerRadius) {
// TODO: Use MaskedCorners to only round specific corners, e.g.: borderTopLeftRadius
// self.view.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
// TODO: On pop the cornerRadius animation doesn't work, even though the CornerRadiusTransition::animateWithProgress function is called.
self.view.layer.masksToBounds = YES;
[animations addObject:[[CornerRadiusTransition alloc] initWithView:self.view fromFloat:_fromView.layer.cornerRadius toFloat:_toView.layer.cornerRadius startDelay:startDelay duration:duration interpolation:interpolation]];
[animations addObject:[[CornerRadiusTransition alloc] initWithView:self.view fromFloat:self.view.location.fromCornerRadius toFloat:self.view.location.toCornerRadius startDelay:startDelay duration:duration interpolation:interpolation]];
}

return animations;
Expand Down