Skip to content

Commit acfa898

Browse files
authored
Removing dynamic layers (#44)
* Removing dynamic layers * version bump
1 parent e33016c commit acfa898

2 files changed

Lines changed: 2 additions & 39 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-leaflet-google-layer",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "React leaflet wrapper of leaflet.gridlayer.googlemutant",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/index.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,4 @@ const createLeafletElement = (props: IProps, context: LeafletContextInterface) =
3636
return { instance, context };
3737
}
3838

39-
const updateLeafletElement = (
40-
instance: L.GridLayer,
41-
props: IProps,
42-
prevProps: IProps
43-
) => {
44-
const prevGoogleMapsAddLayers = prevProps.googleMapsAddLayers
45-
? prevProps.googleMapsAddLayers.map((addLayer: IGoogleMapsAddLayer) => addLayer.name)
46-
: [];
47-
const currentGoogleMapsAddLayers = props.googleMapsAddLayers
48-
? props.googleMapsAddLayers.map((addLayer: IGoogleMapsAddLayer) => addLayer.name)
49-
: [];
50-
51-
if (props.googleMapsAddLayers) {
52-
props.googleMapsAddLayers.forEach((layer) => {
53-
if (prevGoogleMapsAddLayers.indexOf(layer.name) === -1) {
54-
(instance as L.gridLayer.GoogleMutant).addGoogleLayer(
55-
layer.name,
56-
layer.options
57-
);
58-
}
59-
});
60-
}
61-
62-
if (prevProps.googleMapsAddLayers) {
63-
prevProps.googleMapsAddLayers.forEach((layer) => {
64-
if (currentGoogleMapsAddLayers.indexOf(layer.name) === -1) {
65-
(instance as L.gridLayer.GoogleMutant).removeGoogleLayer(layer.name);
66-
}
67-
});
68-
}
69-
70-
updateGridLayer(instance, props, prevProps);
71-
};
72-
73-
export default createLayerComponent<L.GridLayer, LayerProps & IProps>(
74-
createLeafletElement,
75-
updateLeafletElement
76-
);
39+
export default createLayerComponent<L.GridLayer, LayerProps & IProps>(createLeafletElement, updateGridLayer);

0 commit comments

Comments
 (0)