Using a WebView to open external websites

For many apps, it's required that it can open external links, whether its to show a third-party website, your online help, or the terms and conditions of your app.

In this recipe, we will see how to open a WebView by clicking on a button in our app and dynamically setting the URL value.

How to do it...

  1. Similar to our previous recipes, we will start by creating a new app using the React Native CLI, and we will name it Browser. After the new project has been created, open the index.ios.js and index.android.js files; we need to add the following code to bootstrap our app:
            import React from 'react';        import MainApp from './src/MainApp';        import { AppRegistry } from 'react-native';        AppRegistry.registerComponent('Browser', ...

Get React Native Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.