Skip to content

[iOS][Stack] Swipe to go back flash of content opposite to light/dark mode #3758

@kieran-osgood

Description

@kieran-osgood

Description

Swipe navigation back to previous screen on a Stack causes a flash of content that doesn't match the current theme if appearance has changed.

Locally I have patched it this way to get it more akin to what I expect

diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm
index e37e40ab0aa83d46709a75b0fc0f7234da63cdd3..512032fbebc412827d7d425b20900de165c8be34 100644
--- a/ios/RNSScreenStack.mm
+++ b/ios/RNSScreenStack.mm
@@ -258,6 +258,9 @@
   _presentedModals = [NSMutableArray new];
   _controller = [RNSNavigationController new];
   _controller.delegate = self;
+  // Fix: prevent white flash on iOS swipe-back gesture in dark mode.
+  // The nav controller's view has no backgroundColor by default, exposing white during interactive transitions.
+  _controller.view.backgroundColor = [UIColor systemBackgroundColor];
   _sinkEventsPanGestureRecognizer = [[UIPanGestureRecognizer alloc] init];
 #if !TARGET_OS_TV && !TARGET_OS_VISION
   [self setupGestureHandlers];

Steps to reproduce

  1. Launch iOS app
  2. Change color scheme from light to dark, or dark to light, it occurs both ways with a flash of the opposite color (on ios cmd + shift + A)
  3. Swipe back with high momentum
    there will be a flash of the original themes bg color
    reproducible when starting with light, changing to dark and seeing a white bg flash
    and starting from dark, changing to light, and seeing a a black bg flash
Simulator.Screen.Recording.-.iPhone.Air.-.2026-03-12.at.13.23.39.mov

Snack or a link to a repository

https://github.com/kieran-osgood/reproduction-react-native-screens-back-flash

Screens version

4.23.0

React Native version

0.83.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo managed workflow

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Real device

Device model

iPhone Air

Acknowledgements

Yes

Metadata

Metadata

Assignees

Labels

platform:iosIssue related to iOS part of the libraryrepro-providedA reproduction with a snack or repo is provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions