Comments (6)
Hello, I can confirm that. Plus the Callout is below the markers on iOS.
from react-native-map-clustering.
Anyone solved this?
from react-native-map-clustering.
Nope, still hoping someone will come up with a fix :)
from react-native-map-clustering.
I came up with some sort of hack that I am not so proud of but it seems to do the job. If anyone has a better solution, I would be glad to use it :
constructor(props) {
super(props);
this.showCallout = this.showCallout.bind(this);
this.state = {
selectedMarker: null,
selectedMarkersList: [],
};
}
getMarkers() {
return this.state.parks.map((park, i) => (
<Marker
key={park.code}
coordinate={{
latitude: parseFloat(park.lat),
longitude: parseFloat(park.lng),
}}
ref={(c) => {
this[`marker_${i}`] = c;
}}
onPress={() => {
if (Platform.OS === 'android') {
const markerId = `marker_${i}`;
if (!isUndefined(this[markerId])) {
this.setState({
selectedMarker: markerId,
// Needed to keep a list of already used callout, so that they
// are removed by react-native-maps
// prevents this kind of error : https://stackoverflow.com/questions/41819759/trying-to-remove-a-view-index-above-child-count-error
selectedMarkersList: [...this.state.selectedMarkersList, markerId],
}, () => setTimeout(() => this.showCallout(i), 250));
}
} else {
this[`marker_${i}`].showCallout();
}
}}
style={{ zIndex: 10 }}
>
{(() => {
if (Platform.OS === 'android') {
const markerId = `marker_${i}`;
if (
this.state.selectedMarker === markerId
|| this.state.selectedMarkersList.indexOf(markerId) !== -1
) {
return this.renderCallout(park, i);
}
return null;
}
return this.renderCallout(park, i);
})()}
</Marker>
));
}
showCallout(i) {
if (!isUndefined(this[`marker_${i}`]) && this[`marker_${i}`].showCallout) {
this[`marker_${i}`].showCallout();
}
}
renderMap() {
return (
<MapView
region={MAP_REGION}
ref={(c) => { this.mapView = c; }}
style={{ flex: 1, zIndex: 10 }}
clusterTextColor={PVCPTheme.colors.PV_BLUE_DARK}
clusterTextSize={15}
clusterBorderColor="transparent"
clusterBorderWidth={0}
customClusterMarkerDesign={this.getCustomClusterMarkerDesign()}
onClusterPress={(coordinates) => this.onClusterPress(coordinates)}
rotateEnabled={false}
>
{this.getMarkers()}
</MapView>
);
}
Long story short : Callout is never rendered unless marker has been clicked.
from react-native-map-clustering.
I released new version of this library. If this issue will be still relevant please let me know 👍
from react-native-map-clustering.
This issue is still relevant today.
After tapping on the map marker, callout pops up and immediately disappears. It requires second time tap to work properly.
"react-native-map-clustering": "^3.4.2"
"react-native": "0.64.2"
from react-native-map-clustering.
Related Issues (20)
- onRegionChangeComplete wrong second parameter HOT 2
- `mapRef` typing is not accurate HOT 2
- Click on cluster doesn't zoom in and show markers HOT 4
- How to change cluster border? HOT 3
- react-native-map-clustering can not cluster with child component HOT 2
- On iOS, after pressing a cluster and zooming the first time, pressing a marker shows it and then quickly hides it HOT 1
- is there a way to get any meta data from the original data in a cluster? HOT 2
- is there a way to dynamically set calster=false to exclude a specific marker from the cluster without breaking the library logic? HOT 1
- animationEnabled not working HOT 2
- Map Data is not stable on zoom in/out, Incorrect data showing using react-native-map-clustering HOT 2
- On iOS, the app freezes when I use modal
- RNMaps beta support
- On Android, this library is not optimized HOT 3
- Android crash on latest Expo HOT 1
- Marker are hidden until i move the map HOT 10
- clustering on Apple maps does not render all markers
- when we zoom on markers then we are seeing some red lines HOT 3
- Enable `spiralEnabled` without enabling `clusteringEnabled`
- Clicking on the cluster zooms to the wrong location
- Inconsistency in Cluster Rendering between Google and Apple maps in react-native-map-clustering HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-map-clustering.