Open current webview url instead of start url
This commit is contained in:
parent
4492debad9
commit
1639544810
1 changed files with 6 additions and 3 deletions
|
@ -66,6 +66,8 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
|||
customPaddingFunction: null,
|
||||
};
|
||||
|
||||
currentUrl: string;
|
||||
|
||||
webviewRef: {current: null | WebView};
|
||||
|
||||
canGoBack: boolean;
|
||||
|
@ -74,6 +76,7 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
|||
super(props);
|
||||
this.webviewRef = React.createRef();
|
||||
this.canGoBack = false;
|
||||
this.currentUrl = props.url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,8 +225,7 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
|||
};
|
||||
|
||||
onOpenClicked = () => {
|
||||
const {url} = this.props;
|
||||
Linking.openURL(url);
|
||||
Linking.openURL(this.currentUrl);
|
||||
};
|
||||
|
||||
onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||
|
@ -261,7 +263,8 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
|||
onRefresh={this.onRefreshClicked}
|
||||
/>
|
||||
)}
|
||||
onNavigationStateChange={(navState: {canGoBack: boolean}) => {
|
||||
onNavigationStateChange={(navState) => {
|
||||
this.currentUrl = navState.url;
|
||||
this.canGoBack = navState.canGoBack;
|
||||
}}
|
||||
onMessage={props.onMessage}
|
||||
|
|
Loading…
Reference in a new issue