Darren Lau
Darren Lau

Reputation: 2045

React native - show the webpage inside the apps

I'm developing an social apps whereby user can simply attach a website URL, and when other user click on it it will show a webpage within the apps.

For example as below enter image description here

I'm using react navigation, is there a way can achieve this ?

Upvotes: 5

Views: 10274

Answers (1)

Jeff Gu Kang
Jeff Gu Kang

Reputation: 4879

RN > 0.59

Use react-native-webview.

Use WebView.

Example from official link.

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

class MyWeb extends Component {
  render() {
    return (
      <WebView
        source={{uri: 'https://github.com/facebook/react-native'}}
        style={{marginTop: 20}}
      />
    );
  }
}

It will be better use WebView in your component having header and basic control as backbutton and closebutton.

Upvotes: 7

Related Questions