Skip to content

Commit ba3269f

Browse files
committed
refactor(paper): remove macOS specific transform handling code
1 parent 8d07d9c commit ba3269f

File tree

4 files changed

+3
-32
lines changed

4 files changed

+3
-32
lines changed

packages/react-native/React/Views/RCTView.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
161161
/**
162162
* macOS Properties
163163
*/
164-
@property (nonatomic, assign) CATransform3D transform3D;
165164

166165
// `allowsVibrancy` is readonly on NSView, so let's create a new property to make it assignable
167166
// that we can set through JS and the getter for `allowsVibrancy` can read in RCTView.

packages/react-native/React/Views/RCTView.m

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ - (instancetype)initWithFrame:(CGRect)frame
179179
_hitTestEdgeInsets = UIEdgeInsetsZero;
180180
_cursor = RCTCursorAuto;
181181
#if TARGET_OS_OSX // [macOS
182-
_transform3D = CATransform3DIdentity;
183182
_shadowColor = nil;
184183
_mouseDownCanMoveWindow = YES;
185184
#endif // macOS]
@@ -1187,20 +1186,19 @@ - (void)displayLayer:(CALayer *)layer
11871186
#else // [macOS
11881187
RCTUIColor *backgroundColor = _backgroundColor;
11891188
#endif // macOS]
1190-
1189+
11911190
#if TARGET_OS_OSX // [macOS
1192-
CATransform3D transform = [self transform3D];
1191+
CATransform3D transform = [[self layer] transform];
11931192
CGPoint anchorPoint = [layer anchorPoint];
11941193
if (CGPointEqualToPoint(anchorPoint, CGPointZero) && !CATransform3DEqualToTransform(transform, CATransform3DIdentity)) {
11951194
// https://developer.apple.com/documentation/quartzcore/calayer/1410817-anchorpoint
11961195
// This compensates for the fact that layer.anchorPoint is {0, 0} instead of {0.5, 0.5} on macOS for some reason.
11971196
CATransform3D originAdjust = CATransform3DTranslate(CATransform3DIdentity, self.frame.size.width / 2, self.frame.size.height / 2, 0);
11981197
transform = CATransform3DConcat(CATransform3DConcat(CATransform3DInvert(originAdjust), transform), originAdjust);
1199-
// Enable edge antialiasing in perspective transforms
1200-
[layer setAllowsEdgeAntialiasing:!(transform.m34 == 0.0f)];
12011198
}
12021199
[layer setTransform:transform];
12031200
#endif // macOS]
1201+
12041202
if (useIOSBorderRendering) {
12051203
layer.cornerRadius = cornerRadii.topLeftHorizontal;
12061204
layer.borderColor = borderColors.left.CGColor;
@@ -1251,14 +1249,6 @@ - (void)displayLayer:(CALayer *)layer
12511249
[self updateClippingForLayer:layer];
12521250
}
12531251

1254-
#if TARGET_OS_OSX // [macOS
1255-
- (void)updateReactTransformInternal:(CATransform3D)transform
1256-
{
1257-
[self setTransform3D:transform];
1258-
[self setNeedsDisplay];
1259-
}
1260-
#endif // macOS]
1261-
12621252
static BOOL RCTLayerHasShadow(CALayer *layer)
12631253
{
12641254
return layer.shadowOpacity * CGColorGetAlpha(layer.shadowColor) > 0;

packages/react-native/React/Views/UIView+React.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ typedef struct {
8484
- (void)reactSetFrame:(CGRect)frame;
8585

8686

87-
#if TARGET_OS_OSX // [macOS
88-
/**
89-
* Used by macOS to propagate transform changes internally.
90-
*/
91-
- (void)updateReactTransformInternal:(CATransform3D)transform;
92-
#endif // macOS]
93-
9487
/**
9588
* This method finds and returns the containing view controller for the view.
9689
*/

packages/react-native/React/Views/UIView+React.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,21 +306,10 @@ static void updateTransform(RCTPlatformView *view) // [macOS]
306306
transform = view.reactTransform;
307307
}
308308

309-
#if !TARGET_OS_OSX // [macOS]
310309
view.layer.transform = transform;
311310
// Enable edge antialiasing in rotation, skew, or perspective transforms
312311
view.layer.allowsEdgeAntialiasing = transform.m12 != 0.0f || transform.m21 != 0.0f || transform.m34 != 0.0f;
313-
#else // [macOS
314-
[view updateReactTransformInternal:transform];
315-
#endif // macOS]
316-
}
317-
318-
#if TARGET_OS_OSX // [macOS
319-
- (void)updateReactTransformInternal:(CATransform3D)transform
320-
{
321-
// Do nothing, this will get overridden by RCTView and other subclasses as needed.
322312
}
323-
#endif // macOS]
324313

325314
- (UIViewController *)reactViewController
326315
{

0 commit comments

Comments
 (0)