MicheleBertoli / react-gmaps

A Google Maps component for React.js
http://react-gmaps.herokuapp.com/
MIT License
317 stars 68 forks source link

Same Marker always clicked #83

Closed monski closed 7 years ago

monski commented 7 years ago

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>
MicheleBertoli commented 7 years ago

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

monski commented 7 years ago

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