fix(expo): expo-web-browser is not installed as a dependency (#7752)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Adi-Marian Mutu
2026-02-24 08:30:10 +00:00
committed by GitHub
co-authored by Alex Yang
parent ad3fc4cca5
commit 5fc0936400
+13 -9
View File
@@ -360,18 +360,22 @@ export const expoClient = (opts: ExpoClientOptions) => {
undefined;
try {
Browser = await import("expo-web-browser");
} catch (error) {
throw new Error(
'"expo-web-browser" is not installed as a dependency!',
{
cause: error,
},
);
} catch {
try {
Browser = require("expo-web-browser");
} catch (error) {
throw new Error(
'"expo-web-browser" is not installed as a dependency!',
{
cause: error,
},
);
}
}
if (Platform.OS === "android") {
try {
Browser.dismissAuthSession();
Browser!.dismissAuthSession();
} catch {}
}
@@ -387,7 +391,7 @@ export const expoClient = (opts: ExpoClientOptions) => {
params.append("oauthState", oauthStateValue);
}
const proxyURL = `${context.request.baseURL}/expo-authorization-proxy?${params.toString()}`;
const result = await Browser.openAuthSessionAsync(
const result = await Browser!.openAuthSessionAsync(
proxyURL,
to,
opts?.webBrowserOptions,