I have integrated react native map with my latest react native application.In the map i want to set boundaries to the map. The official document suggests the method
setMapBoundaries
but it requires the argument like this northEast: LatLng, southWest: LatLng
.
How can i get the values for these arguments.my mapView is like this.
<MapView
showsUserLocation
provider={MapView.PROVIDER_GOOGLE}
style={styles.map}
region={region}
onRegionChangeComplete={this.onRegionChangeComplete}
setMapBoundaries={}
onUserLocationChange={this.onUserLocationChange}
>
What you are trying to use is not a property
or event
, it's a method
. So you can't use it there. Check the documentation again.
setMapBoundaries(northEast: LatLng, southWest: LatLng): void;
export interface LatLng {
latitude: number;
longitude: number;
}
Try to get the ref
of the MapView,
<MapView
ref={(ref)=> this.mapRef = ref}
/>
and call the method setMapBoundaries
this.mapRef.setMapBoundaries({latitude: 1, longitude: 1},{latitude: 1, longitude: 1})