Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent shadows #1352

Merged
merged 4 commits into from
Aug 11, 2022
Merged
Changes from 2 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
15 changes: 15 additions & 0 deletions React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,21 @@ - (NSString *)description
#endif // TODO(macOS GH#774)

#if TARGET_OS_OSX // [TODO(macOS GH#774)
- (NSShadow*)shadow {
CALayer *layer = self.layer;

// Workaround AppKit issue with directly manipulating the view layer's shadow.
lyzhan7 marked this conversation as resolved.
Show resolved Hide resolved
if (layer.shadowColor != nil && layer.shadowOpacity > 0) {
NSShadow *shadow = [NSShadow new];
lyzhan7 marked this conversation as resolved.
Show resolved Hide resolved

shadow.shadowColor = [[NSColor colorWithCGColor:layer.shadowColor] colorWithAlphaComponent:layer.shadowOpacity];
lyzhan7 marked this conversation as resolved.
Show resolved Hide resolved
shadow.shadowOffset = layer.shadowOffset;
shadow.shadowBlurRadius = layer.shadowRadius;

return shadow;
}
return nil;
}
Saadnajmi marked this conversation as resolved.
Show resolved Hide resolved
- (void)viewDidMoveToWindow
{
// Subscribe to view bounds changed notification so that the view can be notified when a
Expand Down