anarqz / react-leaflet-animated-marker

An animated marker to use with react-leaflet
https://www.npmjs.com/package/react-leaflet-animated-marker
MIT License
3 stars 0 forks source link

Cannot read property 'addLayer' of undefined #3

Open mvoss96 opened 4 years ago

mvoss96 commented 4 years ago

can you provide a basic example on how to integrate tthe animated marker? I'm getting "Cannot read property 'addLayer' of undefined"

not working example:

import React, { Component } from 'react';
import L from 'leaflet';
import { Map, TileLayer } from 'react-leaflet';
import Marker from 'react-leaflet-animated-marker';

class MapComponent extends Component {
  state = {  }
  render() {
    return (
      <Map>
        <Marker position={{ lat: 10, lng: 10 }}/>
      </Map>
    )
  } 
}

export default MapComponent;`
anarqz commented 4 years ago

Hi @mvoss96 ! Thanks for getting in touch.

This project is 2 years old. There's a huge change react-leaflet received some updates since and therefore my library got outdated.

Consider if your project is using the following versions of those deps:

    "leaflet": "^1.3.1",
    "react": "^16.4.0",
    "react-leaflet": "^1.9.1"

:heart:

laurencefass commented 3 years ago

Are there any plans to update for react leaflet 2? or 3? If not can you offer any advice on an upgrade path or how to update the code to work in later versions?

christian-draeger commented 3 years ago

would be interested in support for latest react-leaflet and react version as well