MapView inside a container view
<View style={styles.container}>
<MapView style={[styles.map]}
initialRegion={{
latitude: 18.978189,
longitude: 73.024911,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>
</View>
To give curved border to my map i gave borderRadius to the container view
const styles = {
container:{
marginTop:20,
borderWidth:1,
borderRadius:20
},
map:{
height:200,
},
}
This gave border to my view and my view is actually getting the borderRadius, i cross checked it by giving borderWidth:1. But my map is not getting this border of container. Maps corner get out of the container views border. What should i do to give borderRadius to my map.
Border Radius in React NativeThe borderRadius property can be set as the style attribute to any element. It takes a value in pixels and assigns that value to the overall border radius of that UI element. By default, the border radius of any element is 0 if you haven't added that style attribute to that element.
To set a border, you must first set borderWidth. borderWidth is the size of the border, and it's always a number. You can either set a borderWidth that applies to the entire component or choose which borderWidth you want to set specifically (top, right, bottom, or left).
You can set
overflow: 'hidden'
in your container. It should hide the overflow of the mapView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With