diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 9a302655b69bca..66d2ef7fd2e413 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -558,7 +558,13 @@ - (NSObject *)accessibilityElement NSMutableString *result = [NSMutableString stringWithString:@""]; for (UIView *subview in view.subviews) { NSString *label = subview.accessibilityLabel; - if (!label) { + static Class otherClass = nil; + static BOOL otherClassLookedUp = NO; + if (!otherClass && !otherClassLookedUp) { + otherClass = NSClassFromString(@"RCTView"); + otherClassLookedUp = YES; + } + if (!label && ![subview isKindOfClass:[RCTViewComponentView class]] && ![subview isKindOfClass:otherClass]) { label = RCTRecursiveAccessibilityLabel(subview); } if (label && label.length > 0) { diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index 91e28ab95ec664..91acada949b7bb 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -85,7 +85,13 @@ - (UIView *)react_findClipView NSMutableString *str = [NSMutableString stringWithString:@""]; for (UIView *subview in view.subviews) { NSString *label = subview.accessibilityLabel; - if (!label) { + static Class otherClass = nil; + static BOOL otherClassLookedUp = NO; + if (!otherClass && !otherClassLookedUp) { + otherClass = NSClassFromString(@"RCTViewComponentView"); + otherClassLookedUp = YES; + } + if (!label && ![subview isKindOfClass:[RCTView class]] && ![subview isKindOfClass:otherClass]) { label = RCTRecursiveAccessibilityLabel(subview); } if (label && label.length > 0) {