Skip to content

Commit

Permalink
Aligned sites and site areas map rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixH committed Dec 7, 2021
1 parent f422fdf commit 326f404
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/screens/site-areas/SiteAreas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,18 @@ export default class SiteAreas extends BaseAutoRefreshScreen<Props, State> {
/>
)}
initialRegion={this.currentRegion}
onMapRegionChangeComplete={this.onMapRegionChangeComplete}
onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)}
/>
</View>
)
}

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();
}
}

}
9 changes: 6 additions & 3 deletions src/screens/sites/Sites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ export default class Sites extends BaseAutoRefreshScreen<Props, State> {
}

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() {
Expand Down Expand Up @@ -340,7 +343,7 @@ export default class Sites extends BaseAutoRefreshScreen<Props, State> {
/>
)}
initialRegion={this.currentRegion}
onMapRegionChangeComplete={this.onMapRegionChangeComplete}
onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)}
/>
</View>
)
Expand Down

0 comments on commit 326f404

Please sign in to comment.