fix: add platform check for WebBrowser warmUpAsync on web
This commit is contained in:
parent
16e22f330a
commit
bbd0cfde9c
@ -1,13 +1,17 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import * as WebBrowser from "expo-web-browser";
|
import * as WebBrowser from "expo-web-browser";
|
||||||
|
import { Platform } from "react-native";
|
||||||
|
|
||||||
export const useWarmUpBrowser = () => {
|
export const useWarmUpBrowser = () => {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// Warm up the android browser to improve UX
|
// Warm up the android browser to improve UX
|
||||||
// https://docs.expo.dev/guides/authentication/#improving-user-experience
|
// https://docs.expo.dev/guides/authentication/#improving-user-experience
|
||||||
void WebBrowser.warmUpAsync();
|
// Only available on native platforms (iOS/Android), not on web
|
||||||
return () => {
|
if (Platform.OS !== "web") {
|
||||||
void WebBrowser.coolDownAsync();
|
void WebBrowser.warmUpAsync();
|
||||||
};
|
return () => {
|
||||||
|
void WebBrowser.coolDownAsync();
|
||||||
|
};
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user