I am trying to integrate google maps to my react-native application. For that I am using react-native-map library. I am getting an error while using tag.
Here is the code I have tried:-
<MapView
provider={PROVIDER_GOOGLE} // remove if not using Google Maps
style={styles.map}
initialRegion={{
latitude: region.latitude,
longitude: region.longitude,
latitudeDelta: region.latitudeDelta,
longitudeDelta: region.longitudeDelta,
}}
>
<Marker
coordinate={{
latitude: region.latitude,
longitude: region.longitude,
}}
draggable={true}
>
<Callout>
<Text>Callout</Text>
</Callout>
</Marker>
<Polygon
coordinates={{
latitude: 24.591489,
longitude: 73.722545,
latitudeDelta: 0.0005,
longitudeDelta: 0.0002,
}}
/>
</MapView>
This is the error I am getting :-
Error while updating property 'coordinate' of a view managed by: AIRMapPolygon
Create an array of LatLng like this and try
const [coordinates,setCoordinates] = useState([
{
latitude:36.778259,
longitude: -119.417931
},
{
latitude:47.751076,
longitude: -120.740135
}
])
...
<Polygon
coordinates={coordinates}
/>