3
有没有人有这个问题?我正在使用WebView通过Facebook登录到我的网页。如果用户成功登录,它会将用户重定向到另一个屏幕。react-native中的WebView获取错误“遇到错误加载页面”
我正在使用'react-native-router-flux'。但是,我遇到了一个问题“遇到错误加载页面”。它确实将我重定向到“PresentationScreen”组件,但我仍然有警告&抽屉是我的“PresentationScreen”不存在了。
据我所知,因为服务器正在尝试将我重定向回本地主机。但在onNavigationStateChange
中,我已将其重定向到另一个组件。
以下是错误:
{canGoForward: false, code: -6, canGoBack: false, description: "net::ERR_CONNECTION_REFUSED", loading: false, target: 57, url: "http://localhost:8100/?operation=%2Flogin%2Ffacebook&success=true&message=Account+already+exists"}
这里是我的登录页面组件:
import { Actions as NavigationActions } from 'react-native-router-flux';
class LoginScreen extends React.Component {
constructor (props: LoginScreenProps) {
super(props);
}
handleNavigationStateChange = (event) => {
if (event.url.includes('operation=%2Flogin%2Ffacebook&success=true')) {
NavigationActions.presentationScreen();
}
};
render() {
return (
<WebView source={{uri: 'https://api.taskuparkki.fi/api/login/facebook'}}
onNavigationStateChange = {this.handleNavigationStateChange}
/>
)
}
}
,如果有人发现了一个关于它的解决方案,我将不胜感激。
你的意思是改变从服务器返回到IP服务器地址的本地主机地址?该网址将成为'http://example.com/?operation =%2Flogin%2Ffacebook&success = true&message = Account + already + exists'? –
的确,如果你想使用“example.com”,你应该修改你的主机文件并添加DNS参考。开始使用您的本地IP地址进行测试,或者使用您的服务器中正在使用的任何地址。 –
好的,征求意见。由于我没有服务器的许可,这需要几天的时间。 –