首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在react-native-maps MapView中使用远程图像uri

在react-native-maps MapView中使用远程图像uri
EN

Stack Overflow用户
提问于 2017-09-10 22:56:45
回答 2查看 1.5K关注 0票数 0

我为我的react-native应用程序使用了react-native-map。我需要在地图上的MapView上张贴图像。但是,我从网络上得到了图片。然而,据我所知,只有本地图像可以添加到react-native-map中的Mapview。你知道在react-native-maps MapView中从uri上传图片的方法吗?

我试着用

代码语言:javascript
运行
复制
<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/>

代码语言:javascript
运行
复制
<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>

结果就是

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46142065

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档