Skip to content

feat(ui): add hosted navigation for embedding in host-owned chrome#798

Draft
mikepitre wants to merge 1 commit into
mainfrom
mike/hosted-navigation
Draft

feat(ui): add hosted navigation for embedding in host-owned chrome#798
mikepitre wants to merge 1 commit into
mainfrom
mike/hosted-navigation

Conversation

@mikepitre

@mikepitre mikepitre commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Hosts that embed UserProfileView or AuthView inside their own navigation chrome (the Expo SDK, or native apps with their own top app bar) get a double header, and their back affordances can't reach the components' internal back stacks. This is the Android half of the same feature landing in clerk-ios (clerk-ios#519); the consuming side is clerk/javascript#9121, which needs this in a release before its gradle module compiles. Context: Slack thread.

What this adds

A public ClerkHostedNavigation handle (com.clerk.ui.navigation) plus an optional hostedNavigation parameter on UserProfileView and AuthView (default null = behavior unchanged). When passed:

  • Clerk's top app bars are hidden. ClerkTopAppBar is the single choke point every screen renders through, so hiding is one early-return there.
  • The handle exposes depth / canGoBack as Compose state (driven by snapshotFlow over the component's NavBackStack) and pop() / popToRoot() commands, wired through one shared HostedNavigationEffects composable.
  • The inline add-account flow keeps Clerk's own chrome (it replaces the profile entirely); hosts that want to own it can pass onAddAccount, same as today.

No title reporting — the host owns its header text.

Modules

source/ui only.

Testing

  • :source:ui:testDebugUnitTest: new ClerkHostedNavigationTest plus the full com.clerk.ui.userprofile test package pass
  • spotlessCheck clean
  • detekt reports the same 7 pre-existing findings as untouched main (all in files this PR doesn't modify); zero new findings

No Paparazzi snapshot changes: the default-parameter path renders identically.

🤖 Generated with Claude Code

Hosts that embed UserProfileView or AuthView inside their own navigation
chrome (e.g. the Expo SDK, or apps with their own top app bar) can now pass
the new optional hostedNavigation parameter. When provided, Clerk's top app
bars are hidden and the host observes stack depth and drives pop()/popToRoot()
through the ClerkHostedNavigation handle. Behavior is unchanged when the
parameter is omitted.

Affects the ui module only.
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