Skip to content

feat(expo): Add OrganizationSwitcher native component#8589

Draft
chriscanin wants to merge 1 commit into
mainfrom
chris/expo-organization-selection-bridge
Draft

feat(expo): Add OrganizationSwitcher native component#8589
chriscanin wants to merge 1 commit into
mainfrom
chris/expo-organization-selection-bridge

Conversation

@chriscanin
Copy link
Copy Markdown
Member

Description

Adds a new <OrganizationSwitcher /> native component to @clerk/expo/native, bridging the prebuilt organization-switcher views from clerk-ios and clerk-android into React Native via the same Fabric / Expo native module pattern that already powers <AuthView /> and <UserProfileView />.

import { OrganizationSwitcher } from '@clerk/expo/native'

<OrganizationSwitcher
  onOrganizationChanged={({ organizationId }) => {
    // re-query useOrganization() or refetch as needed
  }}
/>

Mounting <OrganizationSwitcher />:

  • Renders the SwiftUI (iOS) / Jetpack Compose (Android) switcher inline
  • Tapping opens the native overview / account-list / manage sheets
  • Going through "Manage" opens the full OrganizationProfileView flow (members, domains, invitations, action confirmations) on platforms where it has shipped
  • onOrganizationChanged fires on active-org change so JS consumers can refetch useOrganization()

Bridge surface

  • packages/expo/src/specs/NativeClerkOrganizationSwitcher.ts — Fabric codegen spec
  • packages/expo/src/native/OrganizationSwitcher.tsx — RN wrapper, emits onOrganizationChanged
  • packages/expo/ios/ClerkOrganizationSwitcherViewManager.{swift,m} + native view class in ClerkExpoModule.swift
  • packages/expo/android/.../ClerkOrganizationSwitcherViewManager.kt + ClerkOrganizationSwitcherExpoView.kt
  • Updates to ClerkExpo.podspec (source files), ClerkPackage.kt (registered manager), and ClerkViewFactory.swift (new createOrganizationSwitcherView factory method)

⚠️ Upstream dependencies (draft PR pending these)

This component depends on native SDK code that is merged but not yet released:

SDK Status
clerk-ios PR #411 sean/mobile-487-ios-prebuilt-org-views — still OPEN, mergeable, all CI green. Needs merge + tagged release.
clerk-android Org suite (#628#638) all merged to main 2026-05-13 .. 2026-05-16. main is 19 commits ahead of v1.0.16 — needs a v1.0.17 release tag.

The clerkAndroidApiVersion / clerkAndroidUiVersion pins in packages/expo/android/build.gradle are set to 1.0.17 ahead of the tag — consumer builds will fail to resolve until the release ships. Same on iOS: until #411 lands and a release ships, ClerkKitUI.OrganizationSwitcher won't exist for the consumer's SPM resolution.

This PR should land in lock-step with (or after) the native releases. Bump the pins to the actual tagged versions before un-drafting.

Test plan

Verified end-to-end against unreleased native code in clerk-expo-quickstart/NativeComponentQuickstart:

Checklist

  • pnpm build passes (tsup + tsc declarations)
  • pnpm lint clean on changed files
  • pnpm test — n/a, no JS-only logic worth unit testing; verified in quickstart end-to-end
  • JSDoc comments on OrganizationSwitcher + OrganizationSwitcherProps
  • clerk-docs — page drafted locally on chris/docs-expo-organization-switcher (not opened). Native iOS/Android docs don't exist yet either; will land when they do.

Type of change

  • 🌟 New feature

Follow-up

  • Bridge a standalone <OrganizationProfileView /> once both natives ship publicly — for apps that want a dedicated org-settings screen rather than driving everything through the switcher's modal sheet.
  • Open the clerk-docs PR once iOS/Android publish their org docs, to match parity.

Bridges the prebuilt OrganizationSwitcher view from clerk-ios and
clerk-android into @clerk/expo/native as a Fabric-codegen-spec'd component.
Mounting <OrganizationSwitcher /> renders the native SwiftUI / Jetpack
Compose switcher inline; tapping presents the platform's native overview /
account-list / manage sheets, including the full OrganizationProfileView
flow (members, domains, invitations, action confirmations) on platforms
where it has shipped.

Bridge surface:
- src/specs/NativeClerkOrganizationSwitcher.ts (Fabric spec)
- src/native/OrganizationSwitcher.tsx (RN wrapper, onOrganizationChanged)
- ios/ClerkOrganizationSwitcherViewManager.{swift,m} + native view class
- android/.../ClerkOrganizationSwitcherViewManager.kt + ExpoView
- Updated ClerkExpo.podspec source_files, ClerkPackage createViewManagers,
  and the ClerkViewFactory protocol with createOrganizationSwitcherView()

Depends on upstream native releases not yet shipped:
- clerk-ios: PR #411 (sean/mobile-487-ios-prebuilt-org-views) must merge
- clerk-android: 1.0.17 must be tagged (#628-#638 merged to main, no release)
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: fa22bbe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/expo Minor

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 18, 2026 7:57pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant