Access Web Pages through React Native's WebView Component

Share this video with your friends

Send Tweet

We can access web pages in our React Native application using the WebView component. We will connect the links in our repository component to their Github web page when a user click on them.

Joe
Joe
~ 9 years ago

This lesson could use some clean-up.

Using "WEB_VIEW" then "Web_View" in Repositories.js. Naming the component WebView.js which then exports "Web". It's a bit sloppy. One suggestion would be to rename all of them...

As of React Native v0.20 I'm getting this warning "url supplied to WebView has been deprecated. Use the source prop instead"

Changing from: <WebView url={this.props.url}/> to: <WebView source={{uri: this.props.url}}/> solves the issue.

Tyler McGinnis
Tyler McGinnis(instructor)
~ 9 years ago

Thanks for the suggestion! Also, looks like your markdown didn't quite render properly...

christopher
christopher
~ 9 years ago

Can you post Markdown, for the Source Prop Correction? Thanks

Marc Cámara
Marc Cámara
~ 9 years ago

For future developers with this problem, you should use <WebView source={{uri: this.props.url}} /> as url is deprecated.