修复欢迎页android无法通过物理键后退的问题

This commit is contained in:
mx1700 2019-08-25 20:16:11 +08:00
parent fcf86bc1aa
commit 0c02b59a89

View file

@ -59,18 +59,18 @@ export default class WebViewPage extends Component {
} else if(buttonId == 'open') { } else if(buttonId == 'open') {
Linking.openURL(this.webViewState.url); Linking.openURL(this.webViewState.url);
} }
} }
goBack() { goBack = () => {
if (this.webViewState.canGoBack) { if (this.webViewState.canGoBack) {
this.webView.injectJavaScript('window.history.back();'); this.webView.injectJavaScript('window.history.back();');
} else { } else {
Navigation.pop(this.props.componentId); Navigation.pop(this.props.componentId);
} }
} return true;
};
onNavigationStateChange(event) { onNavigationStateChange(event) {
this.webViewState = event; this.webViewState = event;