diff --git a/CHANGELOG.md b/CHANGELOG.md index 4486998e8..ccb633cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Next +- fix: read accessibilityLabel from parent's view to avoid performance hit on RN ([#259](https://github.com/PostHog/posthog-ios/pull/259)) + ## 3.15.5 - 2024-11-19 - fix: properly mask SwiftUI Text (and text-based views) ([#257](https://github.com/PostHog/posthog-ios/pull/257)) diff --git a/PostHog/Replay/UIView+Util.swift b/PostHog/Replay/UIView+Util.swift index 35e9f1c0c..08f713e3d 100644 --- a/PostHog/Replay/UIView+Util.swift +++ b/PostHog/Replay/UIView+Util.swift @@ -22,7 +22,9 @@ if let identifier = accessibilityIdentifier { isNoCapture = checkLabel(identifier) } - if let label = accessibilityLabel, !isNoCapture { + // read accessibilityLabel from the parent's view to skip the RCTRecursiveAccessibilityLabel on RN which is slow and may cause an endless loop + // see https://github.com/facebook/react-native/issues/33084 + if let label = super.accessibilityLabel, !isNoCapture { isNoCapture = checkLabel(label) }