Skip to content

Commit eb4d389

Browse files
hannojgmeta-codesync[bot]
authored andcommitted
fix(ios): add log advice back when using shadow w/o a background (#57618)
Summary: Back on old arch in RCTView.m we printed that warning: https://github.com/react/react-native/blob/d13d2b0a5f7329d5fe9262259e8f846a86312f03/packages/react-native/React/Views/RCTView.m#L898-L906 This was missing on new arch and due to it we were missing some unoptimized views in our app which tanked performance. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [IOS] [ADDED] - Print warning advice when using `shadow*` styles without providing a solid background color Pull Request resolved: #57618 Test Plan: In rn-tester go to APIs > Box Shadow example to see the warnings printed! Reviewed By: shwanton Differential Revision: D113008257 Pulled By: fabriziocucci fbshipit-source-id: 912224c426641325e010ebf261ea56f0b5dfa085
1 parent 5e86c32 commit eb4d389

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#import <React/RCTConversions.h>
2222
#import <React/RCTLinearGradient.h>
2323
#import <React/RCTLocalizedString.h>
24+
#import <React/RCTLog.h>
2425
#import <React/RCTRadialGradient.h>
2526
#import <react/featureflags/ReactNativeFeatureFlags.h>
2627
#import <react/renderer/components/view/ViewComponentDescriptor.h>
@@ -1009,6 +1010,13 @@ - (void)invalidateLayer
10091010
} else {
10101011
// Can't accurately calculate box shadow, so fall back to pixel-based shadow.
10111012
layer.shadowPath = nil;
1013+
1014+
RCTLogAdvice(
1015+
@"View #%ld of type %@ has a shadow set but cannot calculate "
1016+
"shadow efficiently. Consider setting a solid background color to "
1017+
"fix this or applying the shadow to a more specific component.",
1018+
(long)self.tag,
1019+
[self class]);
10121020
}
10131021
} else {
10141022
layer.shadowPath = nil;

0 commit comments

Comments
 (0)