feat(expo): Chris/mobile 405 react native components release#7843
feat(expo): Chris/mobile 405 react native components release#7843chriscanin wants to merge 66 commits intomainfrom
Conversation
- Implemented UserButton component to open UserProfileView on press. - Created UserProfile component for comprehensive profile management. - Integrated native ClerkExpo module for iOS functionality. - Updated ClerkProvider to configure Clerk iOS SDK. - Added exports for new components in the native index file. - Adjusted TypeScript configuration to include additional files. - Modified build process to temporarily skip declaration generation. - Updated dependencies in pnpm-lock.yaml for compatibility.
…d ClerkViewFactory
…ge-ios-to-a-native-module-that-is-available-in-the-expo
…profile management
…ge-android-to-a-native-module-that-is-available-in-the
…ling and UI presentation - Consolidated Clerk SDK initialization and session management in ClerkExpoModule. - Removed ClerkProfileActivity and replaced it with ClerkUserProfileActivity for better clarity and functionality. - Introduced ClerkViewFactory to manage creation of intents for authentication and user profile activities. - Enhanced error handling and promise management for asynchronous operations. - Updated SignIn and UserProfile components to synchronize native and JS session states effectively. - Improved user experience by ensuring the auth modal is always presented, allowing native UI to manage signed-in state. - Added backward-compatible wrappers for SignedIn and SignedOut components.
…and improved session handling
- Updated `clerk-android` versions in `build.gradle` to `0.1.30` for API and `0.1.4` for UI. - Added Kotlin metadata version check skip to address compatibility issues. - Introduced packaging exclusions for duplicate META-INF files in Android. - Enhanced `ClerkAuthActivity` to improve session handling and logging. - Updated `ClerkExpoModule` to include detailed logging for session retrieval. - Improved `ClerkUserProfileActivity` to handle sign-out detection and logging. - Refined `SignIn` and `UserProfile` components to prevent duplicate auth callbacks and improve user state management. - Added packaging exclusions in the Expo config plugin for Android to resolve dependency conflicts.
- Introduced AuthView component to handle sign-in and sign-up using native UI. - Added AuthView types for better type safety. - Removed deprecated SignIn component and its types. - Updated UserButton and UserProfileView components with enhanced documentation. - Refactored ClerkProvider to sync native sessions with JS SDK. - Adjusted TypeScript configurations for improved declaration generation.
…lement crash in React Native
… state management
- packages/expo/package.json: merge new exports (./types) and file entries (google, apple) - packages/expo/src/hooks/index.ts: use main's standard re-exports for useSignIn/useSignUp/useWaitlist - packages/expo/src/provider/singleton/createClerkInstance.ts: use @clerk/clerk-js import (not headless subpath) - packages/react/src/isomorphicClerk.ts: use main's ClerkUI loading pattern via options.ui
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 21933a6 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 |
| @@ -0,0 +1,14 @@ | |||
| // eslint-disable-next-line simple-import-sort/imports, import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member | |||
There was a problem hiding this comment.
ditto, is the order important here to warrant the disables?
| if (ClerkExpoModule?.getClientToken) { | ||
| const nativeClientToken = await ClerkExpoModule.getClientToken(); | ||
| if (nativeClientToken) { | ||
| await SecureStore.setItemAsync(CLERK_CLIENT_JWT_KEY, nativeClientToken, { |
There was a problem hiding this comment.
consider using existing TokenCache if possible, or make it clear why we can't
| /** | ||
| * Render children only when the user is signed in. | ||
| * A convenience wrapper around `<Show when="signed-in">`. | ||
| */ | ||
| export function SignedIn({ children }: PropsWithChildren): ReactNode { | ||
| return <Show when='signed-in'>{children}</Show>; | ||
| } | ||
|
|
||
| /** | ||
| * Render children only when the user is signed out. | ||
| * A convenience wrapper around `<Show when="signed-out">`. | ||
| */ | ||
| export function SignedOut({ children }: PropsWithChildren): ReactNode { | ||
| return <Show when='signed-out'>{children}</Show>; | ||
| } |
There was a problem hiding this comment.
Do we need to diverge from the other SDKs here and continue exporting these?
| async signIn(params?: SignInParams): Promise<OneTapResponse> { | ||
| try { | ||
| return await getNativeModule().signIn(params ?? {}); | ||
| return (await getNativeModule().signIn((params as any) ?? null)) as unknown as OneTapResponse; |
There was a problem hiding this comment.
why the need for type casting now?
|
What integration testing tools are available for react native / expo? Would be great to start seeing those get built out. Maestro seems popular? https://docs.expo.dev/eas/workflows/examples/e2e-tests/ |
.changeset/set-minimum-expo-53.md
Outdated
| ## 2. Removed legacy subpath exports | ||
|
|
||
| The following packages have removed their legacy subpath export mappings: | ||
| - `@clerk/expo` | ||
| - `@clerk/shared` | ||
| - `@clerk/react` | ||
| - `@clerk/localizations` | ||
|
|
||
| **What changed:** | ||
| Previously, these packages used a workaround to support subpath imports (e.g., `@clerk/shared/react`, `@clerk/expo/web`). These legacy exports have been removed in favor of modern package.json `exports` field configuration. | ||
|
|
||
| All public APIs remain available through the main package entry points. |
There was a problem hiding this comment.
I think this should be split up into its own changeset so we don't have contaminate changelogs
Code reviewFound 5 issues:
javascript/.changeset/set-minimum-expo-53.md Lines 1 to 6 in 5f3be94
javascript/packages/expo/package.json Lines 2 to 4 in 5f3be94
javascript/packages/expo/app.plugin.js Lines 1 to 10 in 5f3be94
javascript/packages/expo/app.plugin.d.ts Lines 1 to 6 in 5f3be94
javascript/packages/clerk-js/src/core/fraudProtection.ts Lines 69 to 95 in 5f3be94 Additionally, several issues scored just below the threshold (75/100) that may warrant attention: 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…e module Move captcha document guard from fraudProtection to CaptchaChallenge. Add ClerkKeychainService Info.plist support for extension apps. Use non-enforcing TurboModuleRegistry.get for ClerkGoogleSignIn.
…t-native-components-release # Conflicts: # .changeset/set-minimum-expo-53.md # packages/clerk-js/src/utils/captcha/CaptchaChallenge.ts # packages/expo/package.json # packages/expo/src/components/controlComponents.tsx
The '__clerk_client_jwt' string was duplicated across 4 files. Extract to a single constant in src/constants.ts.
…ore calls Replace direct expo-secure-store imports in AuthView, InlineAuthView, and ClerkProvider with the existing tokenCache from @clerk/expo/token-cache. This consolidates SecureStore options (AFTER_FIRST_UNLOCK) and error handling in one place.
Replace plain Error throws with ClerkRuntimeError from @clerk/shared/error, providing a unique error code (clerk_instance_not_available) and actionable debugging message.
Prevent unbounded polling in AuthView and InlineAuthView. Caps at 40 polls (60s at 1.5s intervals) before stopping gracefully.
Stop swallowing all errors in presentUserProfile catch blocks. Now only silences expected dismissal/cancellation errors from the native module and logs unexpected errors for debugging.
Modal dismissal resolves with { dismissed: true } on the native side,
it does not reject. So the catch block only fires on real errors
(E_NOT_INITIALIZED, E_CREATE_FAILED, E_NO_ROOT_VC). Log them properly
instead of silencing or string-matching.
Log native module errors (E_NOT_INITIALIZED, E_CREATE_FAILED, etc.) only in development. These are configuration errors actionable during dev, not runtime errors to surface to end users.
…rename Move isClerkNetworkError above the createResourceCache block for visibility. Remove the unnecessary const clerk = __internal_clerk alias and use __internal_clerk directly.
Description
These changes can be tested by using the snapshot that will be commented in this PR discussion, and installing that into the expo quickstart repo on the branch:
chris/mobile-343-bridge-android-to-a-native-module-that-is-available-in-the(same branch name as here).
https://linear.app/clerk/issue/MOBILE-342/bridge-ios-to-a-native-module-that-is-available-in-the-expo-sdk
MOBILE-289
https://linear.app/clerk/issue/MOBILE-289/expo-google-universal-sign-in
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores