Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView.props.source.uri is never updated #14556

Closed
savanthongvanh opened this issue Jun 16, 2017 · 2 comments
Closed

WebView.props.source.uri is never updated #14556

savanthongvanh opened this issue Jun 16, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@savanthongvanh
Copy link

WebView uri is never updated.

I'm loading a 3rd party chat client into a webview. The exit button of this this does history.go(-1)
which is not what I want but I have no control. My work around is to monitor the webview and call a function when they hit back. The problem is that I can't find out from the webview when they go back. WebView.props.source.uri never changes after it's loaded regardless of where you navigate to.

I would expect it to tell me the uri of the content currently loaded in the page.

Check out my snack that does this link

import React, { Component } from 'react';
import {WebView } from 'react-native';

var intervalHandle;

export default class App extends Component {

pingWebView (){
console.log(this.wView.props.source.uri);
}

render() {
return (
<WebView
ref={(wView)=>{this.wView = wView}}
source={{uri: "http://www.google.com"}}/>
);
}

componentWillUnmount(){
clearInterval(intervalHandle);
}

componentDidMount(){
console.log('mounted:');
console.log(this.wView);

intervalHandle = setInterval(this.pingWebView.bind(this), 1000);

}
}

Solution

Is this a bug? Is there a workaround?

Additional Information

  • React Native version: 0.34.1
  • Platform: iOS
  • Development Operating System: macos 10.12.1
@savanthongvanh savanthongvanh changed the title WebViewprops.source.uri is never updated WebView.props.source.uri is never updated Jun 16, 2017
@savanthongvanh
Copy link
Author

one workaround is this but it's only available during the event

    onLoadEnd={(e)=>{console.log("loaded");console.log(e.nativeEvent.url);}}
    onLoadStart={(e)=>{console.log("loading");console.log(e.nativeEvent.url);}}

@hramos
Copy link
Contributor

hramos commented Aug 24, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Aug 24, 2017
@hramos hramos closed this as completed Aug 24, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Aug 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants