react-native-geocoder icon indicating copy to clipboard operation
react-native-geocoder copied to clipboard

Allow `latitude` and `longitude` as position properties

Open pcfutures opened this issue 8 years ago • 0 comments

Currently, Geocoder.geocodePosition() takes an object like:

{
    lat: 40.7809261,
    lng: -73.9637594,
}

this PR allows lat and lng to be latitude or longitude instead, respectively:

{
    latitude: 40.7809261,
    longitude: -73.9637594,
}

Just a little nicety for users.

I realised this would be nice to have when using this package alongside react-native-google-place-picker which returns latitude and longitude in it's response, allowing something like this:

RNGooglePlacePicker.show((response) => {
    if (...) {
        ...
    } else {
        const { latitude, longitude } = response;
        Geocoder.geocodePosition({ latitude, longitude }).then(...);
    }
});

pcfutures avatar Aug 25 '17 13:08 pcfutures