0
我的反应原生应用使用react-native-maps
来显示Google地图和标记。样式为View
被用作在设备屏幕上具有固定位置的位置标记。如何在react-native-maps中获取GPS位置
问:我们怎样才能获得标记的GPS坐标(纬度/经度),在说<View style={styles.marker}>
组件的左下角?
<MapView
ref='map'
initialRegion={{
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
showsUserLocation={true}
></MapView>
<View style={styles.markerContainer}>
<View style={styles.marker}>
</View>
</View>
风格
var deviceHeight = Dimensions.get('window').height;
StyleSheet.create({
markerContainer: {
bottom: deviceHeight/2.2,
position: 'absolute',
left: 0,
right: 0,
},
})
我认为你应该使用react-native-maps自己的标记组件https://github.com/airbnb/react-native-maps/blob/master/docs/marker .md,而不是自己的绝对位置 –