Skip to content

Commit

Permalink
Fix crashing the application when a user presses on the map and the G…
Browse files Browse the repository at this point in the history
…oogle Play Services need to be updated or at the moment of the process of updating (react-native-maps#1469)
  • Loading branch information
nikolay-radkov authored and patricio committed Sep 27, 2017
1 parent f553a12 commit ec4c86e
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,18 +720,20 @@ public void stopMonitoringRegion() {
@Override
public void run() {

Projection projection = map.getProjection();
VisibleRegion region = (projection != null) ? projection.getVisibleRegion() : null;
LatLngBounds bounds = (region != null) ? region.latLngBounds : null;

if ((bounds != null) &&
(lastBoundsEmitted == null ||
LatLngBoundsUtils.BoundsAreDifferent(bounds, lastBoundsEmitted))) {
LatLng center = map.getCameraPosition().target;
lastBoundsEmitted = bounds;
eventDispatcher.dispatchEvent(new RegionChangeEvent(getId(), bounds, center, true));
if (map != null) {
Projection projection = map.getProjection();
VisibleRegion region = (projection != null) ? projection.getVisibleRegion() : null;
LatLngBounds bounds = (region != null) ? region.latLngBounds : null;

if ((bounds != null) &&
(lastBoundsEmitted == null ||
LatLngBoundsUtils.BoundsAreDifferent(bounds, lastBoundsEmitted))) {
LatLng center = map.getCameraPosition().target;
lastBoundsEmitted = bounds;
eventDispatcher.dispatchEvent(new RegionChangeEvent(getId(), bounds, center, true));
}
}

timerHandler.postDelayed(this, 100);
}
};
Expand Down

0 comments on commit ec4c86e

Please sign in to comment.