MicheleBertoli / react-gmaps

A Google Maps component for React.js

Home Page:http://react-gmaps.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Same Marker always clicked

monski opened this issue · comments

Hi I got some weird problems.. im always clicking the marker at location 0,0
usually i have 10 at the last data it has lat and lng of 0,0 and each marker i click it was default their.. thanks

                  <Gmaps
                    ref="gmaps"
                    params={MapParams}
                    width={'auto'}
                    height={'600px'}
                    lat={this.state.defaultPoints.lat}
                    lng={this.state.defaultPoints.lng}
                    onMapCreated={this.onMapCreated}
                    zoom={this.state.gmapsZoom}>

                    {resultdata.length > 0 ? (
                      resultdata.map((g,i) => {

                        let onClick = () => {
                            this.toggleInfoModal(g)
                        }

                        return (<Marker onClick={onClick} zIndex={100 +i} key={`maps-${i}`} lat={g.lat} lng={g.lng} />)
                        
                      })
                      ) : null }

                  </Gmaps>

Hello @monski
I'm not sure I understand the problem
Can you please give me more information?
Thanks!

Hi Michele,
thanks for the reply, please consider this as close...close, i did fix now my problem.. what i did is clear previous marker before putting new marker again..

Thanks