Skip to content

fix(ui): drive status-bar icon tint from the theme - #743

Merged
islandbitcoin merged 8 commits into
mainfrom
eng-609/themed-status-bar
Sep 25, 2026
Merged

islandbitcoin merged 8 commits into
mainfrom
eng-609/themed-status-bar

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes ENG-609.

The bug

On Android 15+ the status-bar clock, wifi and signal icons are invisible on light screens — Settings, Bank accounts, the cashout screens. Only the battery shows, because it is drawn in colour rather than tinted. They reappear whenever a dialog scrim darkens the background, which is the tell.

This ships in 0.7.2 today for every user on Android 15 or newer. It is not a regression from the API-36 work: an A/B build on the same tree, same screen, same device showed identical behaviour at targetSdk 35 and 36.

Why

app/app.tsx set the bar globally as a black band with white icons:

<StatusBar
  backgroundColor={"#000"}
  barStyle={Platform.OS === "android" ? "light-content" : undefined}
/>

Android 15+ enforces edge-to-edge and ignores StatusBar.setBackgroundColor, so the black band never renders and the app's own white content shows through. The icons stay white. The part Android took away is the background; the tint is a separate API and still works — we were hard-coding it.

The fix

This grew under review from a three-file tint change into the status-bar story done properly, because each round found a screen class the previous shape got wrong. What HEAD ships:

1. ThemedStatusBar (app/components/themed-status-bar.tsx) — the app-wide default, under ThemeProvider, driving both props from the theme: barStyle dark icons on the light theme and light on the dark theme (which also fixes iOS dark mode, where barStyle was undefined → dark icons on black), and backgroundColor = colors.white. The background is kept, not dropped: it is only dead on Android 15+. With minSdkVersion 26 and no android:statusBarColor in AppTheme, Android 8–14 still paints a real band, and with nothing setting it RN falls back to colorPrimaryDark → material_grey_600 #757575. A __DEV__ guard shouts if it is ever mounted outside ThemeProvider, the shape the original bug had.

2. Screen.statusBar is now live. The prop was declared and documented since the Ignite template and read by nothing — earns-map-screen and earns-section asked for light-content for years and silently got the global. A screen that paints its own full-bleed field (a black camera view, a green success screen, an orange earns section) now declares its tint and gets it, with the screen's own background as the band on Android ≤ 14.

3. statusBarTintFor(hex) (app/utils/status-bar-tint.ts) — the tint is derived from the field's WCAG relative luminance at the white/black crossover (L ≈ 0.179), not hand-picked per screen. Two screens (section-completed, earns-quiz) were missed by the first hand-audit precisely because nothing made a wrong choice detectable; every call site now goes through the helper, so changing a palette token moves the tint with it. Checked against all current fields: #007856, #02c48d, #fff200, #FF7e1c, #C3CCFF, #E6EBEf, #000, #0a0a0a, #454647.

4. FocusedStatusBar — per-screen entries render only while their route is focused. RN's StatusBar stack is mount-ordered, pops only on unmount, and the stack navigator keeps lower routes mounted, so an entry tied to the component's lifetime leaked forward: the scanner's light-content + #000 into a white send-details screen. FeaturedProfileView and NIP17Chat, which push their own entries, are wrapped in the same guard. Falls back to an unscoped entry outside a navigator (ErrorScreen renders Screen above the navigation container, where useIsFocused throws).

Screens re-tinted (13): IdentityCapture, scanning-qrcode-screen, SignInViaQRCode (black camera fields); earns-map-screen, earns-section, section-completed, earns-quiz (palette-independent orange/gold/grey/sky fields — the quiz flips to light icons while its answer sheet's 0.7-black backdrop covers the strip); send-bitcoin-success, CashoutSuccess, InviteFriendSuccess (accent02, which is #007856 light / #02c48d dark — the tint differs by theme and is derived, not hard-coded); account-upgrade-flow/Success (colors.primary, identical in both palettes); BridgeKycWebView, BridgeExternalAccountWebView (headerShown: false over a white hosted page and a white loading scrim).

Tests

1367 passing (was 1294). New or extended:

  • __tests__/components/themed-status-bar.spec.tsx — tint and band per theme, a runtime setMode flip with no remount (the ThemeSyncGraphql path), the dev guard outside a provider.
  • __tests__/components/screen-status-bar-focus.spec.tsx — drives a real two-route stack navigator; after navigating away from an overriding screen the merged StatusBar._propsStack falls back to the themed entry. Covers both the Screen prop and the bare-View shape (FeaturedProfileView). Fails with the focus scoping removed — verified.
  • __tests__/utils/status-bar-tint.spec.ts — the luminance helper, crossover and malformed input.
  • __tests__/screens/{dark-screen,earns-screen,success-screen,bridge-webview}-status-bar.spec.tsx — every re-tinted screen mounted in both themes, asserting the declared tint; the earns spec presses the quiz button and asserts the flip with the sheet open. Each spec pins that its fields really are palette-independent, so a future palette edit fails loudly here.
  • Ten specs that mocked @react-navigation/native with partial objects now spread the real module, so Screen takes the same branch in tests as in production.

StatusBar._propsStack is private RN API. It is the only observable merge point, and if RN changes the shape this fails loudly rather than silently.

Device check (done 2026-09-25, Pixel 8 Pro, Android 17, targetSdk 36, TEST)

Build of this head, embedded bundle (a stray flash-pos Metro on :8081 hijacked the first launch — killed it; noted for anyone else running a debug build with another RN project open).

  • Light theme: Home and Settings icons dark and legible.
  • Dark theme: Home and Settings icons white on black, flipped at runtime via Theme → Dark with no restart.
  • Focus scoping, the round-3 blocker: Scan QR shows white icons over its black field; paste-navigating to send-details (pushed over the still-mounted scanner) shows dark icons on the white screen — the exact path that leaked before; back to the scanner restores white. Both directions correct.
  • Not device-checkable: the earns flow (earns-map, earns-section, section-completed, earns-quiz). The Earn tab is commented out in root-navigator.tsx and nothing else routes into those screens, so they are unmounted in production; their tints are spec-verified only (earns-screen-status-bar.spec.tsx, including the quiz sheet open/closed). Bridge WebViews and the success screens were not driven on device either — Bridge is off for this TEST account and the success screens need a completed payment; both are spec-verified in both themes.
  • Still worth a look elsewhere: an Android 14 or older device, where the band is now the screen colour rather than #757575 grey — none on hand here.

🤖 Generated with Claude Code

@linear

linear Bot commented Sep 25, 2026

Copy link
Copy Markdown

ENG-609

Dread and others added 4 commits September 25, 2026 12:22
Android 15+ enforces edge-to-edge and ignores StatusBar.setBackgroundColor,
so the black band app.tsx painted never rendered and the app's own content
sat behind the status bar. The tint stayed hard-coded to "light-content",
which left white icons on white screens — Settings, Bank accounts and the
cashout screens all showed a clock and signal icons that were invisible
until a dialog scrim darkened the background. This ships in 0.7.2 today for
every user on Android 15 or newer; the API-36 bump neither caused nor
worsened it (verified by an A/B build at targetSdk 35 and 36).

The tint is a separate API and still works, so take it from the theme:
dark icons on the light theme, light icons on the dark theme. That also
fixes iOS dark mode, where barStyle was left undefined and so defaulted to
dark icons.

Reading the theme means living under ThemeProvider, hence a small component
rather than a prop. The two per-screen overrides (FeaturedProfileView,
NIP17Chat) sit over dark headers and stay correct — RN merges the mounted
StatusBar stack per prop, so NIP17Chat still inherits this tint.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review fixes for the ENG-609 status-bar change.

The premise that `backgroundColor` is dead only holds on Android 15+.
minSdkVersion is 26 and AppTheme (Theme.AppCompat.Light.NoActionBar) sets
no android:statusBarColor, so on Android 8-14 the window still paints a
real, opaque band. With nothing in the StatusBar stack setting a
background, RN falls back to DEFAULT_BACKGROUND_COLOR, which resolves via
?android:attr/colorPrimaryDark to material_grey_600 (#757575) -- so
dropping the prop would have shipped a mid-grey band with ~4.5:1 icon
contrast to every Android user below 15.

Paint `colors.white` instead: the same token Screen uses for its own
background, so the band matches the content underneath on Android <= 14
and reproduces the Android 15+ look. setStatusBarColor is a no-op at
targetSdk 35+ on Android 15+ and ignored on iOS, so it costs nothing on
the platforms the fix is aimed at.

Also:
- Correct the docblock on NIP17Chat: it is a light-in-light-theme screen
  that sets only translucent/transparent and inherits this barStyle, so
  it is fixed by the change rather than exempted from it. Only
  FeaturedProfileView owns a dark header and overrides the tint.
- Add a __DEV__ guard so mounting outside ThemeProvider -- the shape the
  original bug had -- is loud instead of silently reverting to the OS
  default tint.

Tests: invert the background assertion (it had pinned the defect into the
suite), add a runtime setMode switch with no remount, which is the path
ThemeSyncGraphql actually takes, and assert the dev guard fires.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review fixes for the themed-status-bar change.

Making the global tint follow the theme fixed the screens that sit on the
theme background and moved the bug to the ones that do not. `ScreenProps`
has carried a `statusBar` prop since the Ignite template, documented as
"Defaults to light-content" and read by nothing — harmless only while the
global happened to be light-content, so the two screens that passed it got
what they asked for by accident. Removing the accident meant a screen could
declare its tint in the codebase's own idiom and silently get the opposite.

- Wire the prop: `Screen` now renders a StatusBar entry when `statusBar` is
  set, in both presets, with the screen's own `backgroundColor` as the band
  colour. RN merges the mounted stack per prop, so an override that names
  only a tint still inherits the themed band rather than resetting it to the
  platform default grey, and screens that name no tint contribute no entry
  at all — the themed one still decides. Docstring corrected.

- Give the light tint to the four full-bleed dark screens that had none:
  IdentityCapture (both branches, black camera view — shipped three commits
  ago in ce85783), scanning-qrcode-screen and SignInViaQRCode (both wrap a
  full-bleed QRCamera; they also now declare the black background the camera
  paints, so the Android <= 14 band matches instead of being stamped white
  above it).

- Give it to the four success screens, which paint a full-bleed #007856
  field under the bar: send-bitcoin-success, InviteFriendSuccess,
  CashoutSuccess and the account-upgrade Success. White icons there are
  5.5:1; the themed dark icons would have been 3.8:1.

- Correct the two stale declarations now that they are live:
  earns-map-screen and earns-section asked for light icons over _sky
  (#C3CCFF), _orange (#FF7e1c) and _gold (#fff200) — light fields in both
  themes, where white icons run 1.1:1 to 2.4:1. Both state dark-content,
  explicitly rather than by theme default, because the default flips to
  light in dark mode over the same light field. earns-map also passes its
  field as the background so the band matches on Android <= 14.

- Tests: __tests__/screens/dark-screen-status-bar.spec.tsx mounts all three
  dark camera screens and asserts each contributes a light-content entry,
  and screen.spec.tsx pins the prop wiring itself (both presets, both tints,
  band colour, and no entry when no tint is declared). Removing the wiring
  fails 7 of them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review caught that ScreenStatusBar leaked. RN's StatusBar stack is
mount-ordered and last-mounted-wins — entries push on mount and pop only on
unmount — and the stack navigator keeps routes below the top mounted. So an
override tied to the component's lifetime followed the user forward: the
scanner's `light-content` + #000 into send-details (a white scroll screen),
SignInViaQRCode into phoneFlow, IdentityCapture into IdentityReview, and
earns-map's `dark-content` onto dark-theme screens. That is the ENG-609
symptom this PR exists to remove, reintroduced one screen later.

Render the entry only while the route is focused. `useIsFocused` throws
outside a navigator and ErrorScreen renders Screen above
NavigationContainerWrapper, so fall back to an unscoped entry when there is
no navigation context — nothing can leak there. Fourteen specs mock
@react-navigation/native with partial objects that omit NavigationContext,
so read a module-level empty context when the import is undefined rather
than calling useContext(undefined).

Also derive the tint on the three accent02 success screens from the theme
mode. accent02 is #007856 in the light theme but #02c48d in the dark one,
where white icons sit at 2.26:1 and black at 9.3:1 — and those screens
already paint their headline with colors.white, which is #000000 in dark
mode, so the bar was pinned white next to black content.
account-upgrade-flow/Success.tsx keeps light-content: colors.primary is
#007856 in both themes.

New spec drives a real two-route stack navigator, navigates away from the
overriding screen and asserts the merged stack falls back to the themed
entry. Verified it fails with the focus scoping removed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@islandbitcoin
islandbitcoin force-pushed the eng-609/themed-status-bar branch from 2968c0e to 90116d6 Compare September 25, 2026 19:29
Dread and others added 4 commits September 25, 2026 13:16
…609)

Review fixes on top of the ENG-609 status-bar work.

The tint rule was re-derived at every call site: three copies of a
`mode === "dark" ? … : …` ternary for accent02 plus hard-coded constants
in five more screens. Nothing made a wrong answer detectable, which is
how two screens were missed and why a future edit to accent02's dark
value would have silently invalidated all three ternaries.

- Add app/utils/status-bar-tint.ts: `statusBarTintFor(hex)` returns the
  legible tint from WCAG relative luminance, flipping at the white/black
  contrast crossover (L = sqrt(1.05 * 0.05) - 0.05). All eight call sites
  now derive the tint from the colour they paint, so a token change
  carries the tint with it. Unit-tested, including a table of every
  background in use in both palettes.
- earns-screen/section-completed and earns-screen/earns-quiz were missed
  in the first sweep: both paint a full-bleed light field (_orange
  #FF7e1c, _lighterGrey #E6EBEf) that is the same in both palettes, so in
  dark mode the themed default gave them white icons at ~2.5:1 and ~1.1:1.
- Lift the focus guard out of Screen into an exported `FocusedStatusBar`
  and route FeaturedProfileView and NIP17Chat through it. Both pushed a
  bare StatusBar that lived for the component's lifetime, so an entry
  could outlive its route and tint whatever was pushed over it — the leak
  the guard was built to stop, one file away.
- Delete the `NoNavigationContext` fallback. It existed only because nine
  specs mocked @react-navigation/native with partial objects, which made
  Screen render the unscoped path in tests while production rendered the
  focused one. Those mocks now spread `jest.requireActual`, so the specs
  exercise what ships.

New coverage:
- __tests__/utils/status-bar-tint.spec.ts — the rule itself.
- __tests__/screens/success-screen-status-bar.spec.tsx — the three
  accent02 success screens in both theme modes; this is the conditional
  case the original three specs left uncovered.
- __tests__/screens/earns-screen-status-bar.spec.tsx — the earns flow,
  including the two screens that were missed.
- screen-status-bar-focus.spec — a bare-View route with its own entry.
- themed-status-bar.spec — FocusedStatusBar outside a navigator, and
  prop pass-through for NIP17Chat's translucent/transparent entry.

Verified by mutation: inverting the tint rule fails 24 tests; dropping
the two new `statusBar` props fails 4.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The changed-lines lint gate flags react-native/no-inline-styles on any
line a PR touches, and the previous commit edited this one to use the
CAMERA_FIELD constant.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review fixes on the ENG-609 status-bar work.

BridgeKycWebView and BridgeExternalAccountWebView were missed by the
sweep, same class as section-completed and earns-quiz. Both routes are
`headerShown: false` over an `unsafe` Screen, so they are fully
edge-to-edge, and the field under the status bar is white in both
palettes: Bridge's hosted page, plus the `rgba(255, 255, 255, 0.9)`
loading scrim that covers the whole screen and is what the user sees
first. With no `statusBar` they took the themed default, so a dark-mode
user got `light-content` — white icons on a white page.

- Name the field (`WEBVIEW_FIELD = "#FFFFFF"`) and derive the tint from
  it with `statusBarTintFor` on the WebView branch of both screens. The
  error branches keep the themed default so their `colors.error` text
  still reads.
- New __tests__/screens/bridge-webview-status-bar.spec.tsx asserts the
  pair in both modes, pins that the scrim really is the white the tint
  was derived for, and pins that the error branch declares no entry.

Correct a comment pasted into ten specs, and the claim in a887297
("Those mocks now spread jest.requireActual, so the specs exercise what
ships"). Both said the spread makes `Screen` take the focus-scoped
status-bar path. It does not: none of those specs mounts a navigator, so
`React.useContext(NavigationContext)` is still `undefined` and
`FocusedStatusBar` still takes the unscoped branch. What the spread
actually buys is that `NavigationContext` is a real context object
rather than `undefined`. The focus-scoped branch is driven against a
real stack navigator in screen-status-bar-focus.spec.tsx, and nowhere
else. The comments now say that.

`useIsFocused: () => true` was flagged as dead in three specs. Verified
by removing it and re-running: dead in success-screen-status-bar only,
where it is now dropped. It is live in the other two — earns-section and
QRCamera call `useIsFocused` themselves and throw outside a navigator
(4 tests fail without it) — so those stay, with a comment naming the
real consumer.

Verified: dropping the two new `statusBar` props fails 4 of the 12 new
tests. Full suite 136 suites / 1365 tests green; tsc and eslint clean on
the changed files.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
earns-quiz derived its tint from the resting field, #E6EBEf, but the
state the user opens the screen to reach is the answer sheet, and
react-native-modal with coverScreen={false} renders the sheet's backdrop
inside the Screen — black at 0.7 over the field, which on an edge-to-edge
window covers the status-bar strip too. Dark icons read at about 2.2:1
there, where the pre-PR light-content read 9.5:1.

Name the composite field (#454647) and keep going through
statusBarTintFor, so the tint flips with quizVisible rather than being
hand-picked for one state. The earns spec now presses the button that
opens the sheet and asserts the flip in both themes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@islandbitcoin
islandbitcoin merged commit 96d3fd8 into main Sep 25, 2026
9 checks passed
@islandbitcoin
islandbitcoin deleted the eng-609/themed-status-bar branch September 25, 2026 22:08
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.

1 participant