React Native Maps - Custom Marker Image Not rendering in Higher Android Versions

旧街凉风 提交于 2019-12-21 05:14:13

问题


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


回答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}
            />
        );



回答2:


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



来源:https://stackoverflow.com/questions/50993542/react-native-maps-custom-marker-image-not-rendering-in-higher-android-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!