我为我的react-native应用程序使用了react-native-map。我需要在地图上的MapView上张贴图像。但是,我从网络上得到了图片。然而,据我所知,只有本地图像可以添加到react-native-map中的Mapview。你知道在react-native-maps MapView
中从uri
上传图片的方法吗?
我试着用
<MapView style={{flex: 1}}
loadingEnabled={true}
region={this.state.region}
onRegionChangeComplete={this.onRegionChangeComplete}>
<MapView.Marker
coordinate={{latitude: this.props.user_location[0], longitude: this.props.user_location[1]}}
title={this.props.user_name}
description={this.props.user_desc}>
<Image source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} />
</MapView.Marker>
</MapView>
结果就是
然后我用下面的命令删除了<Image/>
<MapView style={{flex: 1}}
loadingEnabled={true}
region={this.state.region}
onRegionChangeComplete={this.onRegionChangeComplete}>
<MapView.Marker
coordinate={{latitude: this.props.user_location[0], longitude: this.props.user_location[1]}}
title={this.props.user_name}
description={this.props.user_desc}>
</MapView.Marker>
</MapView>
结果就是
https://stackoverflow.com/questions/46142065
复制相似问题