From 989ce93b9d67e66962f5cc6950006217715932cf Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 20 Nov 2024 09:27:21 +0100 Subject: [PATCH 1/2] fix: read accessibilityLabel from parent's view to avoid performance hit on RN --- CHANGELOG.md | 2 ++ PostHog/Replay/UIView+Util.swift | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4486998e8..1a67a5507 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 ([#257](https://github.com/PostHog/posthog-ios/pull/257)) + ## 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) } From c373608708c01705ee280161ca60875d06699bad Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 20 Nov 2024 09:27:47 +0100 Subject: [PATCH 2/2] fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a67a5507..ccb633cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Next -- fix: read accessibilityLabel from parent's view to avoid performance hit on RN ([#257](https://github.com/PostHog/posthog-ios/pull/257)) +- 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