我使用react-native-webview
来呈现HTML文本。但是在iOS中文本太小而在android中它是完美的。
以下是代码行:
import { WebView } from "react-native-webview";
render() {
<WebView
originWhitelist={['*']}
source={{ html: '<p>This is a static HTML source!</p>' }}
/>
}
附加截图:
使用视口元标记控制移动浏览器上的布局
<meta name="viewport" content="width=device-width, initial-scale=1">
<WebView
originWhitelist={['*']}
source={{ html: '<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body><p>This is a static HTML source!</p></body></html>' }}
/>
链接:https://github.com/react-native-community/react-native-webview/issues/386