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 Masu Lin committed Aug 7, 2017
1 parent e69ca4e commit 5c8e533
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 5c8e533

Please sign in to comment.