Closed dirodriguezm closed 6 years ago
Okay, I found a way to fix it.
When using leaflet with react, events are called onEventname (on with lowercase and the first letter of event name with uppercase). The problem is that the default event is called "geosearch/showlocation" but you cant call onGeosearch/showlocation, so the fix is to modify the event name on leafletControl.js and change "geosearch/showlocation" to something like "showlocation" and then, on your map component you can do something like:
<Map
onShowlocation={this.handleLocationFound}
>
<SearchBar/>
</Map>
This is how I create the control:
and this is how I add it to the map:
onLocationfound is not working here, please help.