在 react-native-maps 上使用 2d Google 地图

Using a 2d Google Map on react-native-maps

我已经尝试查看 react-native-maps 的文档,但终究无法弄清楚为什么 Google 地图显示为 3D:

这就是我想要的(2D 使用 https://mapstyle.withgoogle.com/):

标准代码:

import * as React from 'react';
import MapView, { Polygon, PROVIDER_GOOGLE } from 'react-native-maps';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import mapStyle from './assets/mapStyle.json';

export default function App() {
  return (
    <View style={styles.container}>
      <MapView
        provider={PROVIDER_GOOGLE}
        style={styles.map}
        customMapStyle={mapStyle}
        showsUserLocation>
      </MapView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
  map: {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height,
  },
});

这可能是一个菜鸟问题,但有人知道为什么吗?

<MapView /> 组件的 showsBuildings 设置为 false

参考:https://github.com/react-native-maps/react-native-maps/blob/master/docs/mapview.md