【问题标题】:React-native-maps lite mode don't work at Ios emulatorReact-native-maps lite 模式在 Ios 模拟器上不起作用
【发布时间】:2019-04-15 08:30:20
【问题描述】:

大家下午好,我正在用 React native 开发一个应用程序,我将库 react-native-maps 用于在滚动视图中显示一些固定地图,在 android 中我用标记显示坐标,但是当我在地图中移动时试试滚动

我正在尝试使用 staticmap,但是我必须将地图留在 ios 中的地方我是空白的。

import React, {Component} from 'react'
import {View, Text, TouchableOpacity, Platform, Image} from 'react-native'

import MapApp from './MapApp'

const staticMapURL = 'https://maps.googleapis.com/maps/api/staticmap'

class PropertyListCard extends Component {
	renderMap(){
		if(Platform.OS == 'ios'){
			console.log(Platform.OS)
			return(
				<View
					style={{
						width: 500,
						height:500,
						backgroundColor: 'red'
					}}
				>
				<Image
					source={{uri: "https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=MyGoogleKey"}}
					style={{
						width: 200,
						height: 200
					}}
				/>
				</View>
			)
		}else{
			return(
				<MapApp />
			)
		}
	}

	render(){
		return(
			<View style={styles.container}>
				<View style={styles.titleContainer}>
					<Text style={styles.titleText}>
						{this.props.data.direction}
					</Text>
				</View>
				<View style={styles.mapContainer}>
					{this.renderMap()}
				</View>
				<TouchableOpacity
					style={styles.btn}
					onPress={()=>{}}
				>
					<Text
						style={styles.btnText}
					>
						Ver Vecinos
					</Text>
				</TouchableOpacity>
			</View>
		)
	}
}

const styles = {
	container: {
		flex:1,
		backgroundColor: '#fff',
		margin: 10,
		borderRadius: 10
	},
	titleContainer:{
		height: 40,
		justifyContent: 'center',
		borderBottomWidth: 1,
		borderColor: 'grey'
	},
	titleText: {
		paddingLeft: 20,
		fontSize: 17,
		fontWeight: 'bold'
	},
	mapContainer:{
		width: '100%',
		height: 200
	},
	btn:{
		height: 50,
		width: '100%',
		backgroundColor: '#008591',
		borderBottomLeftRadius: 10,
		borderBottomRightRadius: 10,
		alignItems: 'center',
		justifyContent: 'center',
	},
	btnText: {
		color: '#fff',
		fontSize: 17,
		fontWeight: 'bold',
	}
}

export default PropertyListCard

【问题讨论】:

    标签: ios reactjs react-native react-native-ios react-native-maps


    【解决方案1】:

    【讨论】:

    • 感谢回答我。寻找互联网时,我找到了您的解决方案,即您放入链接中的解决方案,当时探头只是空白了孔并且没有给我涂任何东西。也许我错过了什么。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    • 2019-08-07
    • 2018-03-18
    • 2021-04-29
    • 1970-01-01
    • 1970-01-01
    • 2020-09-14
    相关资源
    最近更新 更多