feat(expo): add embedded navigation mode to native components#9121
feat(expo): add embedded navigation mode to native components#9121mikepitre wants to merge 1 commit into
Conversation
Adds hideHeader, onNavigationChange, and goBack()/popToRoot() refs to the native UserProfileView and AuthView so they can be pushed onto a host navigation stack without a double header, plus a new @clerk/expo/native/router entry with prewired expo-router screens (UserProfileScreen, AuthScreen). expo-router becomes an optional peer dependency. Native halves require clerk-ios and clerk-android releases with hosted navigation support before the pods/gradle modules compile.
🦋 Changeset detectedLatest commit: 7e14106 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Problem
UserProfileViewandAuthViewrender their own navigation header, so pushing them onto an expo-router stack produces a double header, and the route's back button can't reach Clerk's internal screens. Requested by a customer in this thread; internal design discussion here.What this adds
Three tiers, all optional — existing usage is untouched (
hideHeaderdefaults tofalse, and without it the native views take the same code paths as today).1. Drop-in expo-router screens (the recommended path)
New entry point
@clerk/expo/native/router:Push it like any route:
router.push('/account'). The route header keeps the app's own title; its back button, the iOS back gesture, and Android hardware/predictive back all pop Clerk's internal screens first and the route only after that; sign-out and account deletion pop the route automatically.AuthScreenis the same thing for the auth flow:expo-routeris a new optional peer dependency, loaded lazily inside this entry point only — apps not using expo-router never resolve it.2. Raw embedded mode (any navigator, custom headers)
New surface on both
UserProfileViewandAuthView, shared via oneHostedNavigationProps/HostedNavigationRefcontract:hideHeader?: boolean— hides Clerk's built-in header, keeps internal navigation workingonNavigationChange?: ({ depth, canGoBack }) => void— fires on internal push/popgoBack()/popToRoot()3. Existing usage — unchanged
Native implementation
hideHeader, the pod owns theNavigationStack/NavigationPathand passes it throughUserProfileView(navigationPath:), deriving depth and pop from its own path.AuthView's stack is internal to clerk-ios, so it's driven through the new@_spi(FrameworkIntegration)hosted-navigation handle. Bar hiding comes from the same SPI environment value.hostedNavigationparameter to clerk-android's composables and streams depth viasnapshotFlow.Dependencies / merge order
Blocked on SDK releases containing the hosted-navigation support: clerk-ios#519 and clerk-android#798. The native halves here won't compile until those ship and the version pins are bumped. Draft until then.
Testing
UserProfileViewcovering the event unwrap, ref forwarding, and the hideHeader-off path)pnpm lintand fullpnpm build(including declarations for the new entry point) clean🤖 Generated with Claude Code