diff --git a/apple/RNGestureHandlerButton.mm b/apple/RNGestureHandlerButton.mm index 2296c399aa..c9f8067bd6 100644 --- a/apple/RNGestureHandlerButton.mm +++ b/apple/RNGestureHandlerButton.mm @@ -135,20 +135,24 @@ - (NSString *)accessibilityLabel // Vendored from RCTView.m to infer accessibility label from children static NSString *RNGHRecursiveAccessibilityLabel(UIView *view) { - NSMutableString *str = [NSMutableString stringWithString:@""]; + NSMutableString *str = nil; for (UIView *subview in view.subviews) { NSString *label = subview.accessibilityLabel; if (!label) { label = RNGHRecursiveAccessibilityLabel(subview); } if (label && label.length > 0) { + if (str == nil) { + str = [NSMutableString string]; + } if (str.length > 0) { [str appendString:@" "]; } [str appendString:label]; } } - return str.length == 0 ? nil : str; + + return str; } #endif