From 646e4b204b8357b7c84c8fced013cdffcf47a857 Mon Sep 17 00:00:00 2001 From: jgiegeri Date: Thu, 28 Apr 2022 18:08:31 -0400 Subject: [PATCH] fix: set location on asset map upon load --- components/MapView/index.js | 7 +------ domains/DataCollection/Assets/ViewAssets/index.js | 11 ++++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/components/MapView/index.js b/components/MapView/index.js index 68ac8d96b..a89fc68a5 100644 --- a/components/MapView/index.js +++ b/components/MapView/index.js @@ -17,12 +17,7 @@ const Maps = ({ organization }) => { await getData('assetMapRegion').then((data) => { if (isSubscribed) { if (!data) { - setRegion({ - latitude: 18.4861, - longitude: -69.9312, - latitudeDelta: 0.0922, - longitudeDelta: 0.0421, - }); + handleLocation(); } else { setRegion(data); } diff --git a/domains/DataCollection/Assets/ViewAssets/index.js b/domains/DataCollection/Assets/ViewAssets/index.js index 6f06aed0f..b8ed513f1 100644 --- a/domains/DataCollection/Assets/ViewAssets/index.js +++ b/domains/DataCollection/Assets/ViewAssets/index.js @@ -20,12 +20,7 @@ const ViewAssets = ({ organization, switchAssetPage }) => { await getData('assetMapRegion').then((data) => { if (isSubscribed) { if (!data) { - setRegion({ - latitude: 18.4861, - longitude: -69.9312, - latitudeDelta: 0.0922, - longitudeDelta: 0.0421, - }); + handleLocation(); } else { setRegion(data); } @@ -91,7 +86,9 @@ const ViewAssets = ({ organization, switchAssetPage }) => { coordinate={marker.location} title={`${marker.name || ''}`} // description={`Collector: ${marker.surveyingOr}`} - onPress={() => setSelectedMarker(marker)} + onPress={() => {setSelectedMarker(marker) + console.log('hooho') + }} /> ) ))}