If by "from viewport" you mean "what the map is currently showing at it's latitude-longitude position and current zoom level (latitude and longitude deltas)", you can:
As Exilz said in his comment on a github issue
...the region value can be acquired with the event onRegionChangeComplete
.
If you want to zoom programmatically on anything, you can use the method animateToRegion
and pass the coords, and the deltas you got from onRegionChangeComplete
. You just have to find your desired "zoom" by pinching the map, and note down these values.
Here's his sample of code to center / zoom the map on one of his markers :
onPressMarker (markerData) {
this.setState({ openedMarker: markerData });
this.refs.map.animateToRegion({
latitude: parseFloat(markerData.latitude),
longitude: parseFloat(markerData.longitude),
latitudeDelta: 0.0043,
longitudeDelta: 0.0034
});
}
I mostly copied his content, so I urge you go to the github issue and like his comment.