React-google-maps: InfoBox children with onClick event

Created on 6 Dec 2016  路  2Comments  路  Source: tomchentw/react-google-maps

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>

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

const infoBoxProps = {
    position: new google.maps.LatLng(1,2),
    options: {
        enableEventPropagation: true
    },
};

<InfoBox {...infoBoxProps}>
    <div onClick={() => {console.log('clicked')}}>
        lorem ipsum
    </div>
</InfoBox>

All 2 comments

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julienvincent picture julienvincent  路  3Comments

tahir-masood1 picture tahir-masood1  路  4Comments

bossbossk20 picture bossbossk20  路  3Comments

shrimpy picture shrimpy  路  3Comments

bansalvks picture bansalvks  路  3Comments