From cda9dd2fb629b94c1053287795350de243488515 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 16 Feb 2026 12:11:59 -0600 Subject: [PATCH 1/2] Apply Chris changes --- .changeset/sixty-gifts-stand.md | 5 +++++ packages/clerk-js/src/core/clerk.ts | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .changeset/sixty-gifts-stand.md diff --git a/.changeset/sixty-gifts-stand.md b/.changeset/sixty-gifts-stand.md new file mode 100644 index 00000000000..5bdd8dfb7a0 --- /dev/null +++ b/.changeset/sixty-gifts-stand.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': patch +--- + +fix(clerk-js): Handle missing window.location in React Native navigation diff --git a/packages/clerk-js/src/core/clerk.ts b/packages/clerk-js/src/core/clerk.ts index f6c18b85eee..620ac91d190 100644 --- a/packages/clerk-js/src/core/clerk.ts +++ b/packages/clerk-js/src/core/clerk.ts @@ -1666,6 +1666,27 @@ export class Clerk implements ClerkInterface { return; } + // In React Native, window exists but window.location does not. + // If we have a custom router, use it directly. Otherwise, return early. + if (typeof window.location === 'undefined') { + const customNavigate = + options?.replace && this.#options.routerReplace ? this.#options.routerReplace : this.#options.routerPush; + + if (customNavigate) { + debugLogger.info(`Clerk is navigating to: ${to}`); + return await customNavigate(to, { windowNavigate }); + } + + // No window.location and no custom router - can't navigate + if (__DEV__) { + console.warn( + 'Clerk: Navigation was attempted but window.location is not available and no custom router (routerPush/routerReplace) was provided. ' + + 'If you are using React Native, please provide routerPush and routerReplace options to ClerkProvider.', + ); + } + return; + } + /** * Trigger all navigation listeners. In order for modal UI components to close. */ From 2970c9e01d15f6bbc12aedb44eac1df0c9f77e52 Mon Sep 17 00:00:00 2001 From: Sarah Soutoul Date: Mon, 16 Feb 2026 12:58:09 -0600 Subject: [PATCH 2/2] Add full stop for jsdoc --- packages/react/src/hooks/useSignUp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/hooks/useSignUp.ts b/packages/react/src/hooks/useSignUp.ts index 0f57928e0f4..023a9027b1a 100644 --- a/packages/react/src/hooks/useSignUp.ts +++ b/packages/react/src/hooks/useSignUp.ts @@ -6,7 +6,7 @@ import { useIsomorphicClerkContext } from '../contexts/IsomorphicClerkContext'; import { useAssertWrappedByClerkProvider } from './useAssertWrappedByClerkProvider'; /** - * The `useSignUp()` hook provides access to the [`SignUp`](https://clerk.com/docs/reference/javascript/sign-up) object, which allows you to check the current state of a sign-up attempt and manage the sign-up flow. You can use this to create a [custom sign-up flow](!custom-flow) + * The `useSignUp()` hook provides access to the [`SignUp`](https://clerk.com/docs/reference/javascript/sign-up) object, which allows you to check the current state of a sign-up attempt and manage the sign-up flow. You can use this to create a [custom sign-up flow](!custom-flow). * * @unionReturnHeadings * ["Initialization", "Loaded"]