From a48cfc58515d69b6151554c00c6dcea043cc93af Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Wed, 1 Jul 2026 18:47:46 -0400 Subject: [PATCH] fix: skip Fabric SafeAreaView state updates while detached from window When react-native-screens native-stack covers a screen it detaches the screen from the window. The detached SafeAreaView can then read zero safeAreaInsets and commit a zero-inset Fabric state update for the hidden screen, which shows up as a flash of content under the notch or home indicator on pop-back, plus wasted shadow-tree commits for hidden screens. Skip updateStateIfNecessary while the view has no window, mirroring the provider-side superview guard. didMoveToWindow re-runs the update on reattachment, so inset changes that happen while the screen is hidden still propagate. --- ios/Fabric/RNCSafeAreaViewComponentView.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/Fabric/RNCSafeAreaViewComponentView.mm b/ios/Fabric/RNCSafeAreaViewComponentView.mm index 827fa4dd..d622610a 100644 --- a/ios/Fabric/RNCSafeAreaViewComponentView.mm +++ b/ios/Fabric/RNCSafeAreaViewComponentView.mm @@ -93,6 +93,12 @@ - (void)safeAreaProviderInsetsDidChange:(NSNotification *)notification - (void)updateStateIfNecessary { + // A view detached from the window (e.g. a screen covered by a react-native-screens + // native stack) reports zero safeAreaInsets, which would commit a zero-inset layout + // for the hidden screen. + if (self.window == nil) { + return; + } if (_providerView == nil) { return; }