官方文档:
https://reactnative.cn/docs/webview.html#docsNav
使用:
1.添加依赖库:
$ yarn add react-native-webview
$ react-native link react-native-webview
2.代码中使用:
显示连接:
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import { WebView } from "react-native-webview";
export default class Zhh extends Component{
constructor(props){
super(props);
}
render(){
return (
<WebView
source={
{ uri: "https://www.baidu.com/" }}
/>
);
}
}
显示html代码:
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import { WebView } from "react-native-webview"