diff --git a/package.json b/package.json index b5fe494..3ba8a16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-leaflet-kml", - "version": "1.0.3", + "version": "1.0.4", "description": "React leaflet wrapper of leaflet-kml", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 7436e19..c1a1f74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,14 +20,19 @@ class ReactLeafletKml extends MapLayer { } return this.leafletElement; } + + public updateLeafletElement () { + if (this.props.leaflet.map.options.preferCanvas) { + this.props.leaflet.map._renderer._update(); + } + } public componentWillUnmount() { super.componentWillUnmount(); if (this.props.leaflet.map.options.preferCanvas) { - // Handling react-leaflet bug of canvas renderer not updating this.props.leaflet.map._renderer._update(); } } } -export default withLeaflet(ReactLeafletKml); +export default withLeaflet(ReactLeafletKml); \ No newline at end of file