Last active
May 21, 2020 16:03
-
-
Save it-one-mm/5d5ddaf7257e1557b70bb2af799e3437 to your computer and use it in GitHub Desktop.
Fake Locations To Test for Expo Client App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Location from 'expo-location'; | |
const tenMetersWithDegrees = 0.0001; | |
const getLocation = (increment) => { | |
return { | |
timestamp: 1000000, | |
coords: { | |
speed: 0, | |
heading: 0, | |
accuracy: 5, | |
altitudeAccuracy: 5, | |
altitude: 5, | |
longitude: -122.0312186 + increment * tenMetersWithDegrees, // add your current longitude | |
latitude: 37.33233141 + increment * tenMetersWithDegrees, // add your current lattitude | |
}, | |
}; | |
}; | |
let counter = 0; | |
setInterval(() => { | |
Location.EventEmitter.emit('Expo.locationChanged', { | |
watchId: Location._getCurrentWatchId(), | |
location: getLocation(counter), | |
}); | |
counter++; | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment