Here is what I have been attempting unsuccessfully in React:
componentDidUpdate() {
const leafletMap = this.leafletMap.leafletElement;
leafletMap.invalidateSize()
}
With the React page open, I would run this code in the browser Console and see if it causes a redraw. If it does, then we can figure out if there is a different place in the React code this needs to be called from. If it doesn’t work via the Console, then there is another API that we should look at.
Yes. I would try declaring the variable with another name to avoid the naming collision. You could also try this.leafletMap.leafletElement.invalidateSize() and see what happens
This means that the map element isn’t being detected by your current code. I would double check your logic for accessing leafletMap and see if the reference is ever being set. A test you can do on the console might be to bypass React temporarily and just use document.querySelector(" selector path to element ").leafletElement.invalidateSize() or something similar.