Map doesn't render markers on initial load and Cluster Markers disappearing.
See original GitHub issueI am using the library to show markers from Mobx Data store but the markers don’t show unless I have changed the source file and the UI is updated by HotModuleReplacement. Hopefully, I can get a solution as the library is Great!!
Here is my Map Comp:
@inject("map") @observer
export default class Map extends Component {
constructor(props) {
super(props);
}
render() {
const mapStore = this.props.map
const GettingStartedGoogleMap = withGoogleMap((props) => (
<GoogleMap
style={{
height: 100,
width: 100,
}}
onIdle={props.onIdle}
onBoundsChanged={props.onBoundsChanged}
defaultOptions={{ styles: this.mapStyles }}
defaultZoom={mapStore.zoom}
defaultCenter={{ lat: mapStore.center.lat, lng: mapStore.center.lng }}>
{
props.markers.map((marker) => (
<Marker
position={marker}
icon={{
url: require('../../images/marker.png')
}}
/>
))
}
</GoogleMap>
))
return (
<GettingStartedGoogleMap
style={{
height: 100,
width: 100,
}}
onIdle={() => {
mapStore.fetchMarkers()
}}
markers={this.props.map.markers}
containerElement={
<div style={{ height: 'calc(100vh - 70px)' }
} />
}
mapElement={
<div style={{ height: 'calc(100vh - 70px)' }} />
} />
)
}
mapStyles = [MY MAPS STYLES]
}
Thanks in advance!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
React google maps Markers disappear after component re ...
First render of the page -> everything loads fine because everything gets rendered for the first time (including markers).
Read more >Marker Clustering | Maps JavaScript API - Google Developers
This tutorial shows you how to use marker clusters to display a large number of markers on a map. You can use the...
Read more >Changelog | MapSVG
Bugfix Incompatibility with WordPress 5.6; Bugfix Disappearing markers on Google Map after filtering; Bugfix Choropleth colors are incorrect if all regions ...
Read more >Python folium markercluster doesn't work as expected for the ...
https://stackoverflow.com/questions/72222835/folium-put-markers-in-marker-clusters-and-in-layers-based-on-a-value.
Read more >React Leaflet tutorial - LogRocket Blog
We'll show markers with custom icons and display a popup on the map when ... that the map renders itself into, otherwise it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Issue turned out to be related to MobX and I had to do this:
Now I’m having problem with ClusterMarkers, When I zoom in they disappear. Normal Markers work fine without ClusterMarkers.
Could you paste the marker object from your store ? 👍