Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 谷歌地图上的信息窗口未显示_Reactjs_Api_Google Maps - Fatal编程技术网

Reactjs 谷歌地图上的信息窗口未显示

Reactjs 谷歌地图上的信息窗口未显示,reactjs,api,google-maps,Reactjs,Api,Google Maps,我遵循了这里发布的一些建议,但似乎无法让InfoWindows显示在地图上。但即使是记号笔也没有出现?但是api调用正在返回正确的数据 这里是我的大部分代码,不包括api调用,这不是问题的原因。任何帮助都会很好!提前感谢:) {this.state.data.map((结果)=>{ 让keys=Object.keys(结果); 返回key.map(数据=>{ 返回( {this.state.selectedPlace.title} {this.state.selectedPlace.name}

我遵循了这里发布的一些建议,但似乎无法让InfoWindows显示在地图上。但即使是记号笔也没有出现?但是api调用正在返回正确的数据

这里是我的大部分代码,不包括api调用,这不是问题的原因。任何帮助都会很好!提前感谢:)


{this.state.data.map((结果)=>{
让keys=Object.keys(结果);
返回key.map(数据=>{
返回(
{this.state.selectedPlace.title}
{this.state.selectedPlace.name}

); }); })}
        <Map
            google={this.props.google}
            zoom={5}
            style={style}
            gestureHandling={'cooperative'}
            initialCenter={{
            lat: -19.577286,
            lng: 147.406473
            }}
        >
            {this.state.data.map((result) => {
                let keys = Object.keys(result);
                return keys.map(data => {
                    return (
                        <>
                        <Marker 
                            name={result[data].item1}
                            title={result[data].item2}
                            onClick={ this.onMarkerClick }
                            position={{
                              lat: result[data].lat,
                              lng: result[data].long
                            }}
                            animation={this.props.google.maps.Animation.DROP}
                        />
                        <InfoWindow
                            marker = { this.state.activeMarker }
                            visible = { this.state.showingInfoWindow } >

                                <div>
                                    <h4>{ this.state.selectedPlace.title }</h4>
                                    <p>{ this.state.selectedPlace.name }</p>
                                </div>

                        </InfoWindow>
                    </>
                    );
                });
            })}
        </Map>