简体   繁体   English

React Native Maps - 自定义标记图像未在更高的 Android 版本中呈现

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

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.嗨,我正在使用 React-Native 为 Android 开发一个应用程序,它使用react-native-maps包。

All platforms run without any problem, except on Android 7.1+.除 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但在我的情况下,我需要渲染远程图像 URL,所以我无法使用这个道具所以我决定使用自定义标记它工作正常,直到我在更高的 Android 版本中测试我的应用程序

在这里您可以看到标注,但未渲染图像

Use image prop to define image for marker.使用 image prop 定义标记的图像。 It works for android 7+ versions它适用于 android 7+ 版本

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

Its been resolved since , react-native-maps new update which include the fix.它已解决,因为 react-native-maps 包含修复的新更新。 So now I am able to render dynamic Images in maps所以现在我可以在地图中渲染动态图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM