diff --git a/src/screens/site-areas/SiteAreas.tsx b/src/screens/site-areas/SiteAreas.tsx index 1f327b249..fcb997a32 100644 --- a/src/screens/site-areas/SiteAreas.tsx +++ b/src/screens/site-areas/SiteAreas.tsx @@ -340,14 +340,18 @@ export default class SiteAreas extends BaseAutoRefreshScreen { /> )} initialRegion={this.currentRegion} - onMapRegionChangeComplete={this.onMapRegionChangeComplete} + onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)} /> ) } private onMapRegionChangeComplete = (region: Region) => { - this.currentRegion = region; - this.refresh(); - } + if(region.latitude.toFixed(6) !== this.currentRegion.latitude.toFixed(6) || + region.longitude.toFixed(6) !== this.currentRegion.longitude.toFixed(6)) { + this.currentRegion = region; + this.refresh(); + } + } + } diff --git a/src/screens/sites/Sites.tsx b/src/screens/sites/Sites.tsx index 165f6d45d..527b09c7f 100644 --- a/src/screens/sites/Sites.tsx +++ b/src/screens/sites/Sites.tsx @@ -251,8 +251,11 @@ export default class Sites extends BaseAutoRefreshScreen { } public onMapRegionChangeComplete = (region: Region) => { - this.currentRegion = region; - this.refresh(); + if(region.latitude.toFixed(6) !== this.currentRegion.latitude.toFixed(6) || + region.longitude.toFixed(6) !== this.currentRegion.longitude.toFixed(6)) { + this.currentRegion = region; + this.refresh(); + } } public render() { @@ -340,7 +343,7 @@ export default class Sites extends BaseAutoRefreshScreen { /> )} initialRegion={this.currentRegion} - onMapRegionChangeComplete={this.onMapRegionChangeComplete} + onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)} /> )