react-native-maps: Marker image not working on iOS, but works on Android

Summary

On iOS, the MapMarker is not taking the image field and show the default marker look instead. But the same code works on Android.

Image

Reproducible sample code

<MapMarker
        ref={ref || markerRef}
        tracksViewChanges={false}
        coordinate={coordinate}
        onPress={onPress}
        anchor={anchor}
        image={require('../../../assets/images/custom_pin.png')}/>

Steps to reproduce

Run on Android, the MapMarker is showing the specified image in “image” field. Run the same code on iOS, the MapMarker fall back to default marker look

Expected result

On iOS, the MapMarker should also show the specified image

Actual result

On iOS, the MapMarker fall back to default marker look

React Native Maps Version

1.22.6

What platforms are you seeing the problem on?

iOS (Google Maps)

React Native Version

0.76.7

What version of Expo are you using?

Not using Expo

Device(s)

iPhone 12 Pro

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 15 (1 by maintainers)

Most upvoted comments

the issue is fixed in v1.24.2

we still need to finish the migration of all components to be Fabric native to avoid such issues in the future

@basitmir This PR only edits native Android code. I would assume this doesn’t fix the bug motioned in this issue, because this bug only relates to iOS

yeah I noticed this broke in the latest alpha releases and we didn’t detect it before making the public release.

should be simple to fix

Are you sure that a marker with a custom image works on Android? Because I see that it doesn’t work on Android either.

I have added assets to the source dirs and am using it like this:

<Marker image={{ uri: ‘custom_point’ }} />

Map with Google provider. Both iOS and Android have the same behavior – they show the default red marker. I tried to check my assets with a React Native <Image /> component:

<Image source={{ uri: ‘custom_point’ }} style={{ width: 50, height: 50 }} />

I see my image on both platforms. Would be nice if you could fix this as soon as possible. I have been using icon={require(…)}, but now it also doesn’t work.

This is a big issue. Won’t be able to upgrade until this gets fixed.

Anyone found a workaround ?