【发布时间】:2019-11-09 03:06:12
【问题描述】:
我目前正在尝试使用地图功能在我的谷歌地图上填充标记。我似乎无法得到任何填充。是否有我不理解的限制或我遗漏了什么?我尝试用更简单的东西替换 FontAwesomeIcon,但它没有渲染。如果您在 GoogleMapReact 组件中多次复制粘贴 FontAwesomeIcon,它似乎可以工作,但我似乎无法使其与地图一起工作。任何建议将不胜感激。
render() {
const {center, zoom} = this.props;
const listingPins = this.props.testList.map((listing, index) => {
console.log(listing);
if (listing.coordinates.lat === null || listing.coordinates.lng === null){
return null
} else{
return <FontAwesomeIcon icon={faHome} size={"2x"} key={index} listing={listing} lat={listing.coordinates.lat} lng={listing.coordinates.lat} />
}
});
console.log("TEST");
console.log(listingPins);
return (
<div style={{ height: '100vh', width: '100%' }}>
<GoogleMapReact
bootstrapURLKeys={{ key: "key" }}
center={center}
zoom={zoom}
>
{listingPins}
</GoogleMapReact>
</div>
);
}
【问题讨论】:
标签: javascript reactjs google-map-react