[英]Error: WebBrowser is already open, only one can be open at a time
我正在嘗試在 React Native/RNW 應用程序中使用 Expo Auth Session。 它在 iOS 和 web 上運行良好,但是當嘗試在 Android 上使用它時,我在我的 adb 日志中收到以下錯誤消息:
05-15 07:47:57.370 18423 18556 E ReactNativeJS: 'Unhandled promise rejection', { [Error: WebBrowser is already open, only one can be open at a time]
05-15 07:47:57.370 18423 18556 E ReactNativeJS: line: 231503,
05-15 07:47:57.370 18423 18556 E ReactNativeJS: column: 28,
05-15 07:47:57.370 18423 18556 E ReactNativeJS: sourceURL: 'http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false' }
當我單擊此組件(以及非常相似的基於 Facebook 的組件)時,會發生錯誤:
const GoogleAuthBtn = (props) => {
let [request, response, onButtonPress] = Google.useAuthRequest(googleAuth);
useEffect(() => {
if (response && typeof props.onAuthenticate === "function") {
props.onAuthenticate(response, "Google");
}
}, [response]);
return (
<AuthButton
styles={[MainStyles.loginButton]}
icon={<SocialIcon light raised={false} type="google" />}
onPress={onButtonPress}
buttonText={"Sign In with Google"}
/>
);
};
我認為它必須與此調用有關: Google.useAuthRequest(googleAuth)
,因為我試圖將代碼放入 useEffect function,但它不會觸發。
我的 googleAuth 變量看起來像這樣(鍵顯然已編輯):
export const googleAuth = {
responseType: Platform.OS === "web" ? ResponseType.Token : ResponseType.Code,
webClientId: "<redacted>",
expoClientId: "<redacted>",
iosClientId: "<redacted>",
androidClientId: "<redacted>",
iosStandaloneAppClientId: "<redacted>",
androidStandaloneAppClientId: "<redacted>",
androidsecret: "<redacted>",
};
我沒有看到什么可能導致多個 Expo 瀏覽器 windows 一次打開。
它可能是一個沖突的圖書館嗎? 這不在任何類型的 webview 或任何東西中,而且我在應用程序中使用 webviews 只有幾個非常稀疏的區域。
這是在 Expo Bare Workflow React Native 應用程序中
這實際上是由於我的電話
是這樣的:
const AuthButton = (props) => {
return (
<TouchableOpacity self={this} onPress={props.onPress}>
<HoverButton style={LoginButtonStyles}>
{props.icon}
<Text style={MainStyles.loginText}>{props.buttonText}</Text>
<View></View>
</HoverButton>
</TouchableOpacity>
);
};
但是這一行:
<TouchableOpacity self={this} onPress={props.onPress}>
應該是這樣的:
<TouchableOpacity self={this} onPress={() => props.onPress()}>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.