No there isn't, unfortunately. Just found this issue when looking for it.
I'll submit a PR.
PR #43
Hi @JesperWe, can I have an example of draggable marker?
@paradigmist Just apply the PR and do something like:
<Marker draggable={true} onDragEnd={props.onMarkerDragEnd}/>
@JesperWe The PR has been merged right? If I add draggable and onDragEnd attributes my map marker is still unmovable, is there anything I am missing?
Sorry, yes, PR is merged. Dunno what your missing, I stopped using this component and switched to react-google-maps so my memory is fading :-)
PR is merged and released a new version.
Btw the property for drag end is: onDragend, without capital E. could save some time for next person
It is probably a silly question and easy one but I can't seem to figure out how to retrieve the lat and lng after the event is fired. I passed a function on onDragEnd which is like this:
onMarkerDragEnd = (evt) => {
console.log(evt);
}
how do i get the marker position from the evt?
I would like to know as well, how do you get the lat lng ?
Hi @JesperWe, I really tried to figure this out but i can't. How do you get the lat and lng of the marker after the event is being fired? I did this:
<Marker draggable={true} onDragEnd={this.onMarkerDragEnd}/>
and the function onMarkerDragEnd is:
onMarkerDragEnd = (evt) => {
console.log(evt);
}
it logs a google maps object on which i cant figure out the way to retrieve the marker position, i tried a lot of stuff like:
console.log(evt.google.maps.Marker.getPosition().lat());
but it always returns an undefined error. Help is really appreciated!
Thank you very much
@anasyo10 I posted the question on stackoverflow and thanks to tholle the answer is that:
The third argument to the onDragEnd event listener function contains the coordinates of the marker after the drag.
and i tested like this:
onMarkerDragEnd = (one, two, three) => {
const { latLng } = three;
const lat = latLng.lat();
const lng = latLng.lng();
console.log(lat);
};
and it logs the lat so it works! I hope this helps you.
@alexisspa9 you are love, thanks alot.
Thank you @Timothylawler I was banging my head with this!
@alexisspa9 can you tell me what are the first two arguments in onMarkerDragEnd event?
onMarkerDragEnd(mapProps, map) {
console.log('args:', mapProps, map);
console.log(map.getCenter().lat());
}
Most helpful comment
Btw the property for drag end is:
onDragend, without capital E. could save some time for next person