Anyone experiencing issue with adding onClick event to InfoBox children?
import InfoBox from 'react-google-maps/lib/addons/InfoBox';
<InfoBox>
<div onClick={() => {console.log('clicked')}}>
lorem ipsum
</div>
</InfoBox>
ok i figured it out.. the problem wasnt here but in infobox library (https://github.com/lucasfs7/google-maps-infobox-module)
solution: infobox has disabled mouse event propagation by default..
so just set it up by option enableEventPropagation
const infoBoxProps = {
position: new google.maps.LatLng(1,2),
options: {
enableEventPropagation: true
},
};
<InfoBox {...infoBoxProps}>
<div onClick={() => {console.log('clicked')}}>
lorem ipsum
</div>
</InfoBox>
Please refer to Getting Help section in the README (or #469).
Most helpful comment
ok i figured it out.. the problem wasnt here but in infobox library (https://github.com/lucasfs7/google-maps-infobox-module)
solution: infobox has disabled mouse event propagation by default..
so just set it up by option
enableEventPropagation