5

Images aren't shown on Markers.

Hi, I'm developing an app for Android using the React-Native, that uses the react-native-maps package.

All platforms run without any problem, except on Android 7.1+.

All images contained on Markers are not shown/loaded

In Marker Component there is prop called "image" which can be used only with local images. but in my case I need to render remote image Url so i am not able to use this props So i decided to use custom Marker It was working fine until I tested my app in Higher Android version

Here you can see the callout but the image is not rendered

Prince Antony P
  • 141
  • 2
  • 10
  • Similar issue has been reported in their repo: https://github.com/react-community/react-native-maps/issues/1552 – blaz Jul 11 '18 at 09:17
  • can u provide your code as well? –  Aug 14 '18 at 06:21
  • see my answer you can use SVG for rendering images. https://stackoverflow.com/a/52756571/2037889 – krish Oct 11 '18 at 09:25

2 Answers2

1

Use image prop to define image for marker. It works for android 7+ versions

return (
            <MapView.Marker
              key={`marker-${index}`}
              coordinate={{ latitude: Number(latitude), longitude: Number(longitude) }}
              onPress={options.onPress ? () => options.onPress(marker) : false}
              image={icons[marker.type] || icons.default}
              style={styles.marker}
              identifier={marker._id}
            />
        );
0

Its been resolved since , react-native-maps new update which include the fix. So now I am able to render dynamic Images in maps

Prince Antony P
  • 141
  • 2
  • 10