From d2e28964321d25ff1ca73e6fc9e63c821855014d Mon Sep 17 00:00:00 2001 From: Yoavpagir <134851360+Yoavpagir@users.noreply.github.com> Date: Tue, 21 Jul 2026 22:18:02 +0300 Subject: [PATCH] fix(customrow): only attach BottomTabs custom row to NavigationActivity BottomTabsCustomRowAttacher is a global Application.ActivityLifecycleCallbacks that ran tryAttach()/findViewById() on every activity in the process. On a foreign, non-AppCompat-themed activity (e.g. AppAuth RedirectUriReceiverActivity during OAuth login) this forces AppCompat sub-decor inflation and crashes with 'You need to use a Theme.AppCompat theme'. Guard so the observer only touches RNN's own NavigationActivity, where BottomTabs actually live. Sentry: WIX-ONE-APP-9GFHV --- .../customrow/BottomTabsCustomRowAttacher.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowAttacher.kt b/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowAttacher.kt index 064b854cf6..f1a1a21075 100644 --- a/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowAttacher.kt +++ b/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowAttacher.kt @@ -9,6 +9,7 @@ import android.view.ViewGroup import android.view.ViewTreeObserver import android.view.WindowInsets import android.widget.FrameLayout +import com.reactnativenavigation.NavigationActivity import com.reactnativenavigation.views.bottomtabs.BottomTabs /** @@ -77,6 +78,13 @@ internal object BottomTabsCustomRowAttacher : Application.ActivityLifecycleCallb } private fun ensureLayoutObserver(activity: Activity) { + // BottomTabs only ever live inside RNN's own NavigationActivity (an + // AppCompatActivity). Touching any other activity — e.g. a third-party + // relay such as AppAuth's RedirectUriReceiverActivity, whose theme is not + // a Theme.AppCompat descendant — forces AppCompat sub-decor inflation and + // crashes with "You need to use a Theme.AppCompat theme". Guard here so the + // global lifecycle observer never operates on foreign activities. + if (activity !is NavigationActivity) return val decor = activity.window?.decorView as? ViewGroup ?: return if (decor.getTag(TAG_OBSERVING) == true) return decor.setTag(TAG_OBSERVING, true) @@ -90,6 +98,7 @@ internal object BottomTabsCustomRowAttacher : Application.ActivityLifecycleCallb } private fun tryAttach(activity: Activity) { + if (activity !is NavigationActivity) return val scanRoot = activity.window?.decorView as? ViewGroup ?: activity.findViewById(android.R.id.content) as? ViewGroup ?: return