File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
packages/react-native/React
Fabric/Mounting/ComponentViews/View Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ @implementation RCTUIView
129129 BOOL _clipsToBounds;
130130 BOOL _userInteractionEnabled;
131131 BOOL _mouseDownCanMoveWindow;
132+ BOOL _respondsToDisplayLayer;
132133}
133134
134135+ (NSSet <NSString *> *)keyPathsForValuesAffectingValueForKey : (NSString *)key
@@ -158,6 +159,7 @@ @implementation RCTUIView
158159 self->_userInteractionEnabled = YES ;
159160 self->_enableFocusRing = YES ;
160161 self->_mouseDownCanMoveWindow = YES ;
162+ self->_respondsToDisplayLayer = [self respondsToSelector: @selector (displayLayer: )];
161163 }
162164 return self;
163165}
@@ -259,7 +261,12 @@ - (void)updateLayer
259261 // so it has to be reset from the view's NSColor ivar.
260262 [layer setBackgroundColor: [_backgroundColor CGColor ]];
261263 }
262- [(id <CALayerDelegate >)self displayLayer: layer];
264+
265+ // In Fabric, wantsUpdateLayer is always enabled and doesn't guarantee that
266+ // the instance has a displayLayer method.
267+ if (_respondsToDisplayLayer) {
268+ [(id <CALayerDelegate >)self displayLayer: layer];
269+ }
263270}
264271
265272- (void )drawRect : (CGRect)rect
Original file line number Diff line number Diff line change @@ -2025,6 +2025,11 @@ - (NSString *)componentViewName_DO_NOT_USE_THIS_IS_BROKEN
20252025 return RCTNSStringFromString ([[self class ] componentDescriptorProvider ].name );
20262026}
20272027
2028+ - (BOOL )wantsUpdateLayer
2029+ {
2030+ return YES ;
2031+ }
2032+
20282033@end
20292034
20302035#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments