菜鸟教程小白 发表于 2022-12-11 18:29:40

ios - React 原生 map 集成


                                            <p><p>我正在尝试将 map 集成到 nativereact 中。我正在遵循以下教程。
<a href="https://github.com/airbnb/react-native-maps" rel="noreferrer noopener nofollow">https://github.com/airbnb/react-native-maps</a> </p>

<p>我浏览了所有的安装说明。
我正在使用 <code>react-native 版本:0.44.0</code> 和 <code>react-native-map 版本:0.13.0</code>
我确保 <code>react-native-link</code> 与 android 和 iOS 链接。
在 ios 模拟器中渲染 mapView 时, map 没有显示,只有我能够显示带有红色轮廓的空白 map 。</p>

<p>请检查我下面的代码,让我知道我哪里错了。</p>

<pre><code>var MapView = require(&#39;react-native-maps&#39;);
&lt;MapView
    initialRegion={{
    latitude: 37.78825,
    longitude: -122.4324,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421,
    }}
/&gt;
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>尝试添加一个 View 和一些高度和 ...StyleSheet.absoluteFillObject</p>

<pre><code>&lt;View style={{height:400}}&gt;
    &lt;MapView
         style={{ ...StyleSheet.absoluteFillObject,height:400 }}
         initialRegion={{
             latitude: 37.78825,
             longitude: -122.4324,
             latitudeDelta: 0.0922,
             longitudeDelta: 0.0421,
         }}
    /&gt;
&lt;/View&gt;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - React 原生 map 集成,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45622366/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45622366/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - React 原生 map 集成