How to render a web page in your React Native apps?

How to render a web page in your React Native apps?
Photo by Anita Austvika / Unsplash

use React Native Webview

I haven't wrote react native apps for years. Recently I start work on react native again. just learned:

React Native WebView is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be removed from core).
GitHub - react-native-webview/react-native-webview: React Native Cross-Platform WebView
React Native Cross-Platform WebView. Contribute to react-native-webview/react-native-webview development by creating an account on GitHub.

Example Code

Note: Please at least set a height for the Webview component or its parent. Otherwise, the web page will not be displayed on your screen.

const Word = ({ word, src }: WordProps) => {
    return <View style={{ minHeight: 400, height: "100%" }}>
        <WebView source={{ uri: src }}
            style={{/** height:400 */}}
        ></WebView>
    </View>
}

Subscribe to Post, Code and Quiet Time.

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe