Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidValueError: setIcon: not a string; and no url property; and no path property #396

Open
MAyankprine20001 opened this issue Jul 25, 2024 · 0 comments

Comments

@MAyankprine20001
Copy link

when i call this first time for dropping the image in the map then is show me error InvalidValueError: setIcon: not a string; and should be a PinView; and no url property; and no path property . this is come when is call import React from "react";
import { Marker } from "@react-google-maps/api";

const DraggableMarker = ({
gatePosition,
gateImage,
handleGateDrag,
handleGateDrop,
gateId,
rotation,
}) => {
// console.log("gate image" , pos)
const onDragEnd = (e) => {
const newLat = e.latLng.lat();
const newLng = e.latLng.lng();
handleGateDrop({ lat: newLat, lng: newLng }, gateId);
};

const onDrag = (e) => {
const newLat = e.latLng.lat();
const newLng = e.latLng.lng();
handleGateDrag({ lat: newLat, lng: newLng });
};

return (


<Marker
position={gatePosition}
draggable
onDrag={onDrag}
onDragEnd={onDragEnd}
icon={{
path: gateImage,
scale: 0.07,
fillColor: "#000000",
fillOpacity: 1,
strokeWeight: 0.7,
anchor: new google.maps.Point(0, 0),
scaledSize: new google.maps.Size(30, 30),
rotation: rotation,
}}
options={{
crossOnDrag: false,
}}
/>

);
};

export default DraggableMarker;
can any resolv this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant