Skip to content

fix(navigation): paint scene background to remove white flicker#912

Merged
CassioMG merged 1 commit into
mainfrom
cg-fix-modal-white-flicker
Jun 23, 2026
Merged

fix(navigation): paint scene background to remove white flicker#912
CassioMG merged 1 commit into
mainfrom
cg-fix-modal-white-flicker

Conversation

@CassioMG

@CassioMG CassioMG commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Sets an explicit dark theme (NAVIGATION_THEME) on the top-level NavigationContainer so the native screen background is dark everywhere. Central fix for the white flicker reported in #899 (comment).

Why

Without a theme, React Navigation defaults to its light theme, which Native Stack uses as each screen's native contentStyle background — briefly revealed (as a white flash at the corners) during transitions before the dark JS layout paints. See the JSDoc in config/navigationTheme.ts for the full breakdown.

Before fix

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-23.at.12.30.20.mov
Screen.Recording.2026-06-23.at.12.37.59.mov

After fix

after-fix.mov
Screen.Recording.2026-06-23.at.12.37.11.mov

Checklist

PR structure

  • This PR does not mix refactoring changes with feature changes (break it down into smaller PRs if not).
  • This PR has reasonably narrow scope (break it down into smaller PRs if not).
  • This PR includes relevant before and after screenshots/videos highlighting these changes.
  • I took the time to review my own PR.

Testing

  • These changes have been tested and confirmed to work as intended on Android.
  • These changes have been tested and confirmed to work as intended on iOS.
  • These changes have been tested and confirmed to work as intended on small iOS screens.
  • These changes have been tested and confirmed to work as intended on small Android screens.
  • I have tried to break these changes while extensively testing them.
  • This PR adds tests for the new functionality or fixes.

Release

  • This is not a breaking change.
  • This PR updates existing JSDocs when applicable.
  • This PR adds JSDocs to new functionalities.
  • I've checked with the product team if we should add metrics to these changes.
  • I've shared relevant before and after screenshots/videos highlighting these changes with the design team and they've approved the changes.

🤖 Generated with Claude Code

The NavigationContainer was rendered without a theme, so React Navigation
fell back to its light DefaultTheme (background rgb(242,242,242)). Native
Stack uses the theme's colors.background as each screen's default
contentStyle background, so the light native scene container showed through
during transitions — most visibly as a white flicker at the iOS modal's
rounded corners while a screen slides in horizontally (e.g. the Send flow's
slide_from_right push).

Set a dark NAVIGATION_THEME (extends DarkTheme, overrides background/card
with the app's #161616 surface token) on the NavigationContainer so the
native scene background is dark everywhere. This is a central fix covering
every navigator and screen rather than patching a single flow.

NAVIGATION_THEME lives in its own config/navigationTheme module rather than
config/theme so the design-token file stays free of the React Navigation
dependency — config/theme is imported by nearly every component, and several
component tests replace @react-navigation/native with an inline mock that
omits DarkTheme.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CassioMG CassioMG changed the title fix(navigation): paint scene background to remove white modal flicker fix(navigation): paint scene background to remove white flicker Jun 23, 2026
@CassioMG CassioMG self-assigned this Jun 23, 2026
@CassioMG CassioMG marked this pull request as ready for review June 23, 2026 15:32
Copilot AI review requested due to automatic review settings June 23, 2026 15:32
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an explicit React Navigation theme at the app root so native stack scenes render with the app’s dark surface color during transitions, preventing the brief white “flash” that can appear (notably around iOS modal rounded corners) before JS layout paints.

Changes:

  • Introduces a dedicated NAVIGATION_THEME that extends React Navigation’s DarkTheme but uses the app’s design-token surface for colors.background (and colors.card).
  • Applies NAVIGATION_THEME to the top-level <NavigationContainer> in App.tsx.
  • Adds a unit test asserting the navigation theme does not fall back to DefaultTheme’s light background.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/config/navigationTheme.ts Defines NAVIGATION_THEME to force a dark native scene background consistent with app tokens.
src/components/App.tsx Wires the navigation theme into the root NavigationContainer.
__tests__/config/navigationTheme.test.ts Verifies the theme background/card match app surface tokens and differs from DefaultTheme.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

iOS Simulator preview build is ready: https://github.com/stellar/freighter-mobile/releases/tag/untagged-62c3c7740b60a820fbfe (SDF collaborators only — install instructions in the release description)

@CassioMG CassioMG merged commit e705859 into main Jun 23, 2026
31 of 36 checks passed
@CassioMG CassioMG deleted the cg-fix-modal-white-flicker branch June 23, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants