add form create inquiryPrivacyFencing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useFormikContext } from "formik";
|
||||
import { useRef } from "react";
|
||||
import { Marker, useMapEvents } from "react-leaflet"
|
||||
import { Marker, useMapEvents } from "react-leaflet";
|
||||
|
||||
const prefix = process.env.NODE_ENV === "production" ? "/v3" : "";
|
||||
|
||||
@@ -10,21 +9,20 @@ const locationMarker = L.icon({
|
||||
iconAnchor: [25, 50],
|
||||
});
|
||||
|
||||
const MarkerLocation = () => {
|
||||
const { setFieldValue } = useFormikContext()
|
||||
const MarkerLocation = ({ setValue }) => {
|
||||
const location = useRef();
|
||||
const map = useMapEvents({
|
||||
move: (e) => {
|
||||
const latlon = e.target.getCenter()
|
||||
location.current?.setLatLng(latlon);
|
||||
setFieldValue('lat', latlon.lat)
|
||||
setFieldValue('lon', latlon.lng)
|
||||
setValue('lat', latlon.lat)
|
||||
setValue('lon', latlon.lng)
|
||||
},
|
||||
zoom: (e) => {
|
||||
const latlon = e.target.getCenter()
|
||||
location.current?.setLatLng(latlon);
|
||||
setFieldValue('lat', latlon.lat)
|
||||
setFieldValue('lon', latlon.lng)
|
||||
setValue('lat', latlon.lat)
|
||||
setValue('lon', latlon.lng)
|
||||
},
|
||||
});
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user