react-native-maps: Marker with custom images does not show callout sometimes. Callout appears behind markers.
I’m trying to use markers with custom images. Out of 3 markers, only one shows callout when I tap on it. And the callout appears behind the other markers.
The same problem occurs if I use my custom markers. It works just fine if I use the default pin marker.
Code
export default class MockMapApp extends Component {
constructor(props) {
super(props);
this.state = {
places: [
{
title: 'A',
latitude: -31.433333,
longitude: 152.900000,
},
{
title: 'B',
latitude: -31.428564,
longitude: 152.912478,
},
{
title: 'C',
latitude: -31.440208,
longitude: 152.918615,
}
],
region: {
latitude: -31.433333,
longitude: 152.900000,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}
};
}
render() {
return (
<MapView
style={{flex: 1}}
region={this.state.region}
onRegionChangeComplete={region => this.setState({region: region})}>
{this.state.places.map((place, index) => {
const coord = {latitude: place.latitude, longitude: place.longitude};
return (
<MapView.Marker
key={index} identifier={`${index}`}
coordinate={coord}
image={require('./images/planned-icon.png')}
onPress={() => console.log(`marker ${place.title} pressed`)}>
{/* <MyMarkerView identifier={`${index}`} coordinate={coord} title={place.title}/> */}
<MapView.Callout style={{width: 300, height: 100}}>
<MyCalloutView title={place.title}/>
</MapView.Callout>
</MapView.Marker>
);
})}
</MapView>
);
}
}
/*
class MyMarkerView extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={{
width: 44, height: 44,
flexDirection: 'row', justifyContent: 'center', alignItems: 'center',
backgroundColor: 'transparent'
}}>
<View style={{
width: 20, height: 20, borderRadius: 10,
justifyContent: 'center', alignItems: 'center',
backgroundColor: 'red'}}>
<Text style={{color: 'white'}}>
{"P"}
</Text>
</View>
</View>
);
}
}
*/
class MyCalloutView extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={{backgroundColor: 'white'}}>
<Text>{this.props.title}</Text>
</View>
);
}
}
MyCalloutView.propTypes = {
title: React.PropTypes.string.isRequired
}
Screenshot

Thanks,
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 16 (4 by maintainers)
Commits related to this issue
- Fixed callouts displaying behind markers. Fixes #553, fixes #662, fixes #751 — committed to laeijebor/react-native-maps by laeijebor 8 years ago
- Merge pull request #936 from RajkumarPunchh/FitToElements-Fix Fixed issue #751. — committed to react-native-maps/react-native-maps by deleted user 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to nitaliano/react-native-maps by deleted user 7 years ago
- Fixed issue #751 — committed to alexHlebnikov/react-native-maps by alexHlebnikov 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to markdgo/react-native-maps by deleted user 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to MarcoAntonioAG/React-map by deleted user 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to joshpeterson30489/maps-develop-with-react-native by joshpeterson30489 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to superstar1205/Map-ReactNative by superstar1205 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to anthony0506/react-native-maps by anthony0506 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to johney6767/Map-ReactNative by deleted user 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to GoldenDragon0710/google-map-react-native by GoldenDragon0710 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to PainStaker0331/react-native-maps by PainStaker0331 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to Super-CodeKing/react_native_map by Super-CodeKing 7 years ago
- Fixed issue #751. https://github.com/airbnb/react-native-maps/issues/751 — committed to fairskyDev0201/react-native-maps by fairsky0201 7 years ago
Nope, no one cares about it
Same, with a fresh install of 0.12.1 and react-native 0.38.
I care about it, but I suspect that airbnb does not since their app does not use callouts at all.
I am working around it in my app by creating a component that uses this library on Android and the included react-native maps library on iOS. Of course the capabilities are different, and the iOS maps has its own set of problems (sometimes shows default markers; custom markers are anchored in the center).
I first tried to use Google Maps on iOS, but the documentation for setting that up is really spotty. I guess this is just the nature of react-native libraries at this early stage.