From ba8258388180901cac2514cd916fa96132d3abe2 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 9 Apr 2026 14:19:19 +0200 Subject: [PATCH] fix: ignore isLaidOut check for React Native replay --- .changeset/quick-pigs-rule.md | 5 +++++ .../com/posthog/android/replay/PostHogReplayIntegration.kt | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/quick-pigs-rule.md diff --git a/.changeset/quick-pigs-rule.md b/.changeset/quick-pigs-rule.md new file mode 100644 index 00000000..a942a20e --- /dev/null +++ b/.changeset/quick-pigs-rule.md @@ -0,0 +1,5 @@ +--- +'posthog-android': patch +--- + +Ignore `isLaidOut` checks for React Native session replay. diff --git a/posthog-android/src/main/java/com/posthog/android/replay/PostHogReplayIntegration.kt b/posthog-android/src/main/java/com/posthog/android/replay/PostHogReplayIntegration.kt index 954c381a..54a8170b 100644 --- a/posthog-android/src/main/java/com/posthog/android/replay/PostHogReplayIntegration.kt +++ b/posthog-android/src/main/java/com/posthog/android/replay/PostHogReplayIntegration.kt @@ -66,6 +66,7 @@ import com.posthog.android.replay.internal.NextDrawListener.Companion.onNextDraw import com.posthog.android.replay.internal.ViewTreeSnapshotStatus import com.posthog.android.replay.internal.isAlive import com.posthog.android.replay.internal.isAliveAndAttachedToWindow +import com.posthog.internal.PostHogSessionManager import com.posthog.internal.PostHogThreadFactory import com.posthog.internal.replay.PostHogSessionReplayHandler import com.posthog.internal.replay.RRCustomEvent @@ -671,7 +672,7 @@ public class PostHogReplayIntegration( private fun View.isViewStateStableForMatrixOperations(): Boolean { return try { isAttachedToWindow && - isLaidOut && + (isLaidOut || PostHogSessionManager.isReactNative) && // Check if view has valid dimensions width > 0 && height > 0 && // Check if view is not in layout transition (API 18+)