1
+ diff --git a/node_modules/react-native-shared-element/ios/RNSharedElementCornerRadii.m b/node_modules/react-native-shared-element/ios/RNSharedElementCornerRadii.m
2
+ index 5060067..413281a 100644
3
+ --- a/node_modules/react-native-shared-element/ios/RNSharedElementCornerRadii.m
4
+ +++ b/node_modules/react-native-shared-element/ios/RNSharedElementCornerRadii.m
5
+ @@ -69,8 +69,8 @@ static CGFloat RNSharedElementDefaultIfNegativeTo(CGFloat defaultValue, CGFloat
6
+ CALayer *mask = nil;
7
+ CGFloat cornerRadius = 0;
8
+
9
+ - if (RCTCornerRadiiAreEqual(radii)) {
10
+ - cornerRadius = radii.topLeft;
11
+ + if (RCTCornerRadiiAreEqualAndSymmetrical(radii)) {
12
+ + cornerRadius = radii.topLeftHorizontal;
13
+ } else {
14
+ CAShapeLayer *shapeLayer = [CAShapeLayer layer];
15
+ RCTCornerInsets cornerInsets = RCTGetCornerInsets(radii, UIEdgeInsetsZero);
16
+ @@ -121,36 +121,52 @@ static CGFloat RNSharedElementDefaultIfNegativeTo(CGFloat defaultValue, CGFloat
17
+ const CGFloat directionAwareBottomLeftRadius = isRTL ? bottomEndRadius : bottomStartRadius;
18
+ const CGFloat directionAwareBottomRightRadius = isRTL ? bottomStartRadius : bottomEndRadius;
19
+
20
+ - result.topLeft = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopLeftRadius);
21
+ - result.topRight = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopRightRadius);
22
+ - result.bottomLeft = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomLeftRadius);
23
+ - result.bottomRight = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomRightRadius);
24
+ + result.topLeftHorizontal = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopLeftRadius);
25
+ + result.topRightHorizontal = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopRightRadius);
26
+ + result.bottomLeftHorizontal = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomLeftRadius);
27
+ + result.bottomRightHorizontal = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomRightRadius);
28
+ + result.topLeftVertical = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopLeftRadius);
29
+ + result.topRightVertical = RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopRightRadius);
30
+ + result.bottomLeftVertical = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomLeftRadius);
31
+ + result.bottomRightVertical = RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomRightRadius);
32
+ } else {
33
+ const CGFloat directionAwareTopLeftRadius = isRTL ? _radii[RNSharedElementCornerTopEnd] : _radii[RNSharedElementCornerTopStart];
34
+ const CGFloat directionAwareTopRightRadius = isRTL ? _radii[RNSharedElementCornerTopStart] : _radii[RNSharedElementCornerTopEnd];
35
+ const CGFloat directionAwareBottomLeftRadius = isRTL ? _radii[RNSharedElementCornerBottomEnd] : _radii[RNSharedElementCornerBottomStart];
36
+ const CGFloat directionAwareBottomRightRadius = isRTL ? _radii[RNSharedElementCornerBottomStart] : _radii[RNSharedElementCornerBottomEnd];
37
+
38
+ - result.topLeft =
39
+ + result.topLeftHorizontal =
40
+ RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerTopLeft], directionAwareTopLeftRadius));
41
+ - result.topRight =
42
+ + result.topRightHorizontal =
43
+ RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerTopRight], directionAwareTopRightRadius));
44
+ - result.bottomLeft =
45
+ + result.bottomLeftHorizontal =
46
+ RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerBottomLeft], directionAwareBottomLeftRadius));
47
+ - result.bottomRight = RNSharedElementDefaultIfNegativeTo(
48
+ + result.bottomRightHorizontal = RNSharedElementDefaultIfNegativeTo(
49
+ + radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerBottomRight], directionAwareBottomRightRadius));
50
+ + result.topLeftVertical =
51
+ + RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerTopLeft], directionAwareTopLeftRadius));
52
+ + result.topRightVertical =
53
+ + RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerTopRight], directionAwareTopRightRadius));
54
+ + result.bottomLeftVertical =
55
+ + RNSharedElementDefaultIfNegativeTo(radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerBottomLeft], directionAwareBottomLeftRadius));
56
+ + result.bottomRightVertical = RNSharedElementDefaultIfNegativeTo(
57
+ radius, RNSharedElementDefaultIfNegativeTo(_radii[RNSharedElementCornerBottomRight], directionAwareBottomRightRadius));
58
+ }
59
+
60
+ // Get scale factors required to prevent radii from overlapping
61
+ - const CGFloat topScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.width / (result.topLeft + result.topRight)));
62
+ - const CGFloat bottomScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.width / (result.bottomLeft + result.bottomRight)));
63
+ - const CGFloat rightScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topRight + result.bottomRight)));
64
+ - const CGFloat leftScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topLeft + result.bottomLeft)));
65
+ -
66
+ - result.topLeft *= MIN(topScaleFactor, leftScaleFactor);
67
+ - result.topRight *= MIN(topScaleFactor, rightScaleFactor);
68
+ - result.bottomLeft *= MIN(bottomScaleFactor, leftScaleFactor);
69
+ - result.bottomRight *= MIN(bottomScaleFactor, rightScaleFactor);
70
+ + const CGFloat topScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.width / (result.topLeftHorizontal + result.topRightHorizontal)));
71
+ + const CGFloat bottomScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.width / (result.bottomLeftHorizontal + result.bottomRightHorizontal)));
72
+ + const CGFloat rightScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topRightHorizontal + result.bottomRightHorizontal)));
73
+ + const CGFloat leftScaleFactor = RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topLeftHorizontal + result.bottomLeftHorizontal)));
74
+ +
75
+ + result.topLeftHorizontal *= MIN(topScaleFactor, leftScaleFactor);
76
+ + result.topRightHorizontal *= MIN(topScaleFactor, rightScaleFactor);
77
+ + result.bottomLeftHorizontal *= MIN(bottomScaleFactor, leftScaleFactor);
78
+ + result.bottomRightHorizontal *= MIN(bottomScaleFactor, rightScaleFactor);
79
+ + result.topLeftVertical *= MIN(topScaleFactor, leftScaleFactor);
80
+ + result.topRightVertical *= MIN(topScaleFactor, rightScaleFactor);
81
+ + result.bottomLeftVertical *= MIN(bottomScaleFactor, leftScaleFactor);
82
+ + result.bottomRightVertical *= MIN(bottomScaleFactor, rightScaleFactor);
83
+
84
+ _cachedBounds = bounds;
85
+ _cachedRadii = result;
86
+ diff --git a/node_modules/react-native-shared-element/ios/RNSharedElementStyle.m b/node_modules/react-native-shared-element/ios/RNSharedElementStyle.m
87
+ index 9f65b9d..6ae25d8 100644
88
+ --- a/node_modules/react-native-shared-element/ios/RNSharedElementStyle.m
89
+ +++ b/node_modules/react-native-shared-element/ios/RNSharedElementStyle.m
90
+ @@ -112,10 +112,10 @@
91
+ CGRect radiiRect = CGRectMake(0, 0, 1000000, 1000000);
92
+ RCTCornerRadii radii1 = [style1.cornerRadii radiiForBounds:radiiRect];
93
+ RCTCornerRadii radii2 = [style2.cornerRadii radiiForBounds:radiiRect];
94
+ - [style.cornerRadii setRadius:radii1.topLeft + ((radii2.topLeft - radii1.topLeft) * position) corner:RNSharedElementCornerTopLeft];
95
+ - [style.cornerRadii setRadius:radii1.topRight + ((radii2.topRight - radii1.topRight) * position) corner:RNSharedElementCornerTopRight];
96
+ - [style.cornerRadii setRadius:radii1.bottomLeft + ((radii2.bottomLeft - radii1.bottomLeft) * position) corner:RNSharedElementCornerBottomLeft];
97
+ - [style.cornerRadii setRadius:radii1.bottomRight + ((radii2.bottomRight - radii1.bottomRight) * position) corner:RNSharedElementCornerBottomRight];
98
+ + [style.cornerRadii setRadius:radii1.topLeftHorizontal + ((radii2.topLeftHorizontal - radii1.topLeftHorizontal) * position) corner:RNSharedElementCornerTopLeft];
99
+ + [style.cornerRadii setRadius:radii1.topRightHorizontal + ((radii2.topRightHorizontal - radii1.topRightHorizontal) * position) corner:RNSharedElementCornerTopRight];
100
+ + [style.cornerRadii setRadius:radii1.bottomLeftHorizontal + ((radii2.bottomLeftHorizontal - radii1.bottomLeftHorizontal) * position) corner:RNSharedElementCornerBottomLeft];
101
+ + [style.cornerRadii setRadius:radii1.bottomRightHorizontal + ((radii2.bottomRightHorizontal - radii1.bottomRightHorizontal) * position) corner:RNSharedElementCornerBottomRight];
102
+
103
+ style.borderWidth = style1.borderWidth + ((style2.borderWidth - style1.borderWidth) * position);
104
+ style.borderColor = [RNSharedElementStyle getInterpolatedColor:style1.borderColor color2:style2.borderColor position:position];
105
+ diff --git a/node_modules/react-native-shared-element/ios/RNSharedElementTransition.m b/node_modules/react-native-shared-element/ios/RNSharedElementTransition.m
106
+ index 97de533..dbd1d66 100644
107
+ --- a/node_modules/react-native-shared-element/ios/RNSharedElementTransition.m
108
+ +++ b/node_modules/react-native-shared-element/ios/RNSharedElementTransition.m
109
+ @@ -388,10 +388,10 @@
110
+ },
111
+ @"contentType": item.content ? item.content.typeName : @"none",
112
+ @"style": @{
113
+ - @"borderTopLeftRadius": @(cornerRadii.topLeft),
114
+ - @"borderTopRightRadius": @(cornerRadii.topRight),
115
+ - @"borderBottomLeftRadius": @(cornerRadii.bottomLeft),
116
+ - @"borderBotomRightRadius": @(cornerRadii.bottomRight)
117
+ + @"borderTopLeftRadius": @(cornerRadii.topLeftHorizontal),
118
+ + @"borderTopRightRadius": @(cornerRadii.topRightHorizontal),
119
+ + @"borderBottomLeftRadius": @(cornerRadii.bottomLeftHorizontal),
120
+ + @"borderBotomRightRadius": @(cornerRadii.bottomRightHorizontal)
121
+ }
122
+ };
123
+ self.onMeasureNode(eventData);
0 commit comments