React native 在react native webview中映射,如何缩放?
我使用react native webview将地图放在webview中,如下所示:React native 在react native webview中映射,如何缩放?,react-native,webview,maps,zooming,React Native,Webview,Maps,Zooming,我使用react native webview将地图放在webview中,如下所示: <WebView geolocationEnabled={true} source={{ uri: "https://www.blablabla", }} originWhitelist={[ "https://www.blavla.org",
<WebView
geolocationEnabled={true}
source={{
uri:
"https://www.blablabla",
}}
originWhitelist={[
"https://www.blavla.org",
"https://www.blabla.com",
]}
style={{ marginHorizontal: 0, backgroundColor: "transparent" }}
/>
给我这个:
但正如你所看到的,它不是很清楚,我想放大以更好地阅读地图(它太小了,这样我们什么都看不懂)。请问我怎么做
谢谢你的帮助!!!:) 您的站点已经在meta中设置了页面宽度 因此,您需要使用injectedJavaScript覆盖它
injectedJavaScript={`const meta = document.createElement('meta');
meta.setAttribute('content', 'width=device-width, initial-scale=0.5, maximum-
scale=0.5, user-scalable=0'); meta.setAttribute('name', 'viewport');
document.getElementsByTagName('head')[0].appendChild(meta); `}
scalesPageToFit={false}