storing and retrieving long and lat values

This commit is contained in:
Arjun Patel
2018-06-15 20:47:46 -07:00
parent aa7574a9fc
commit 43ece13696
4 changed files with 65 additions and 32 deletions
+6 -4
View File
@@ -25,7 +25,7 @@ export default class Loading extends Component<Props> {
console.log('Getting User Location:');
this.latitude = parseFloat(position.coords.latitude);
this.longitude = parseFloat(position.coords.longitude);
console.log(String(this.latitude) + ' ' + String(this.longitude));
console.log(this.latitude.toString() + ' ' + this.longitude.toString());
this.storeValues();
Actions.main();
},
@@ -39,9 +39,11 @@ export default class Loading extends Component<Props> {
storeValues = async () => {
try {
await AsyncStorage.setItem('long', this.longitude);
await AsyncStorage.setItem('lat', this.latitude);
console.log('Stored Values!');
var toStore = [['long', this.longitude.toString()], ['lat', this.latitude.toString()]];
await AsyncStorage.multiSet(toStore, () => {
console.log('Stored values!');
Actions.main();
});
} catch (error) {
console.log(error);
}