无法使用 borderRadius 制作 react-native-maps

Can't make react-native-maps with borderRadius

我正在使用 React Native,我想将 borderRadius 添加到我的 google 地图视图中,但没有成功

<View
        style={{
          backgroundColor: "#fff",
          flex: 1,
          borderRadius: 30,
          margin: 20,
        }}
      >
        <Map />
      </View>
      <View
        style={{
          marginTop: 40,        
          flexDirection: "column",
          justifyContent: "center",
          height: 300,
          width: 370,
        }}
      >

地图组件:

const Map = () => {
  return (
    <MapView
      style={tw`flex-1`}
      customMapStyle={mapStyle}
      initialRegion={{
        latitude: 37.78825,
        longitude: -122.4324,
        latitudeDelta: 0.0922,
        longitudeDelta: 0.0421,
      }}
    />
  );
};

result here

那么我怎样才能正确地做到这一点?

您应该在视图中映射组件,将边框半径和溢出属性设置为“隐藏”,如下所示:

const Map = () => {
  return (

    <View
      style={
        borderRadius: 50,
        overflow: "hidden"
      }
    >
      <MapView
        style={tw`flex-1`}
        customMapStyle={mapStyle}
        initialRegion={{
          latitude: 37.78825,
          longitude: -122.4324,
          latitudeDelta: 0.0922,
          longitudeDelta: 0.0421,
        }}
      />
    </View>
    
  );
};

这对我有用,添加溢出并使用 alightItems 居中

            <View style={{ 
                height: moderateScale(300) - 60, 
                zIndex: -1, 
                borderRadius: 10, 
                borderWidth: 1, 
                borderColor: userInterface.buttonSelectedFill, 
                overflow: 'hidden',
                alignItems: 'center',
                justifyContent: 'center'}}>

                <MapView 
                    style={{flex: 1, height: '100%', width: '100%', borderRadius: 10, }} 
                    //ref={ map => {currentMap = map }}
                    //region={props.region}
                    rotateEnabled={false}
                    loadingEnabled={true}
                ></MapView>                
            </View>