Skip to content

navigationStyle overrides headerBackVisible: false, injecting a back chevron on screens that opt out #139

Description

@theanmolsharma

navigationStyle injects a custom headerLeft back chevron whenever closeButton === CloseButtonPosition.None, which silently overrides screens that opt out of back navigation via headerBackVisible: false.

headerBackVisible only governs the native back button — it cannot suppress a custom headerLeft — so any screen passing headerBackVisible: false through navigationStyle still gets a chevron.

Affected screens

navigation/WalletExportStack.tsx:24WalletExport

options={navigationStyle({
  headerBackVisible: false,
  title: loc.wallets.export_title,
})(theme)}

Before #137 this screen was first-route-in-stack, so the old !headerLeft && !isFirstRouteInStack gate skipped it and headerBackVisible: false did its job — no back button, deliberately. #137's gate (closeButton === CloseButtonPosition.None) now fires for it, so a chevron appears. On a seed-phrase export screen that's worth an explicit decision rather than a side effect.

navigation/AddWalletStack.tsx:53-60PleaseBackup

options={navigationStyle({
  gestureEnabled: false,
  headerBackVisible: false,
  title: loc.pleasebackup.null,
})(theme)}

gestureEnabled: false + headerBackVisible: false reads as a clear intent to keep the user on the screen until they've backed up. This one is pre-existing — it isn't first-route-in-stack, so the old gate already injected a chevron and already defeated the opt-out. #137 only changed its color. So the seed-backup step has been skippable via the header chevron for a while.

Not affected: DetailViewScreensStack.tsx:66 and OnboardingStack.tsx:19 both pair headerBackVisible: false with headerShown: false, so there's no header to put a button in.

Suggested fix

Honor the opt-out in the gate:

if (closeButton === CloseButtonPosition.None && opts.headerBackVisible !== false) {
  headerLeft = (props: any) => (props.canGoBack ? <HeaderBackButton  /> : null);
}

opts is already in scope (it's read for presentation a few lines above) and headerBackVisible is a valid NativeStackNavigationOptions field, so this typechecks as-is. It restores WalletExport to its intended headerless state and closes the PleaseBackup gap in the same line.

Decisions needed

  1. Should WalletExport have a back chevron? If yes, drop headerBackVisible: false from its options so the intent matches the behavior — right now the code says one thing and the UI does another either way.
  2. Should PleaseBackup actually be non-dismissable? If so, the fix above is required; if users are meant to be able to skip it, remove gestureEnabled: false / headerBackVisible: false so the intent is legible.

Context

Found while reviewing #137 (merged after #131). Not a blocker for #137 — the behavior change there is limited to WalletExport — but it should be settled rather than inherited silently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions