Kind of a barebones approach to draggable markers, saving the new position in state By Franklin Harvey
interface MarkerProps {
position: google.maps.LatLng
onDragMarker(e: google.maps.MouseEvent): void
}
DraggableMarker = (props: MarkerProps) => (
<Marker
position={props.position}
draggable
onDragEnd={props.onDragMarker}
/>
)
... in some component class ...
render() {
return (
<DraggableMarker
position={this.state.markerPosition}
onDragMarker={this.onDragMarker}
/>
)
}
onDragMarker = (e: google.maps.MouseEvent) => {
this.setState({
markerPosition: e.latLng
})
}