[英]Not able to render the infoWindow in react-google-maps
I was trying to add an InfoWindow to the mid point of a polyline.我试图将 InfoWindow 添加到折线的中点。
This is my code for displaying the infoWindow.这是我用于显示信息窗口的代码。
<InfoWindow
position={this.state.windowPosition}
onCloseclick={this.toggleInfoWindow}
options={{pixelOffset: new google.maps.Size(0,-30)}}
>
<p>iggd</p>
</InfoWindow>
windowPosition here is the lat and lng of the midpoint of the polyline. windowPosition 是折线中点的纬度和经度。 When I try to run this I am getting an error saying that You must provide either an anchor (typically render it inside a <Marker>) or a position props for <InfoWindow>
.当我尝试运行它时,我收到一条错误消息,提示You must provide either an anchor (typically render it inside a <Marker>) or a position props for <InfoWindow>
。 But the owner of the repo said that (link's here) we can render an infoWindow where ever we want if we pass a position as props which I am doing.但是 repo 的所有者说(链接在这里)如果我们将一个位置作为我正在做的道具传递,我们可以在我们想要的任何地方渲染一个 infoWindow。
Any help is appreciated.任何帮助表示赞赏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.