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

Problem with using method setPaths #99

Open
jarikus18 opened this issue Dec 27, 2019 · 0 comments
Open

Problem with using method setPaths #99

jarikus18 opened this issue Dec 27, 2019 · 0 comments

Comments

@jarikus18
Copy link

jarikus18 commented Dec 27, 2019

HI! I can't understand how to use method setPaths.
I wanna update the component and change the lines.

When I try to send new props with coordinates, old coordinates also staying.

`
const PolylineDecorator = withLeaflet(props => {

const { positions } = props;
const polyRef = useRef();

useEffect(() => {
const polyline = polyRef.current.leafletElement; //get native Leaflet polyline
const { map } = polyRef.current.props.leaflet; //get native Leaflet map

L.polylineDecorator(polyline, {
  patterns: props.patterns,
}).addTo(map);

}, [positions]);
return <Polyline ref={polyRef} {...props} opacity="0" />;
});
`
Screenshot at Dec 27 14-19-48
Screenshot at Dec 27 14-15-18

@jarikus18 jarikus18 changed the title Problem with using method setPatterns Problem with using method setPaths Dec 27, 2019
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