React Native 地理定位、地图与用户输入组件全解析
1. 地理定位与地图
在 React Native 中,地理定位和地图功能十分实用。要使用地图,可安装第三方 react-native-maps 包。下面将介绍如何在地图上绘制点和覆盖区域。
1.1 绘制点
我们可以在地图上绘制一些当地的啤酒厂位置。以下是向 MapView 组件传递注释的代码示例:
import React from 'react';
import {
AppRegistry,
View,
} from 'react-native';
import MapView from 'react-native-maps';
import styles from './styles';
const PlottingPoints = () => (
<View style={styles.container}>
<MapView
style={styles.mapView}
showsPointsOfInterest={false}
showsUserLocation
followUserLocation
>
<MapView.Marker
description="Duff beer for me, Duff beer for you"
coordinate={
{
超级会员免费看
订阅专栏 解锁全文
1万+

被折叠的 条评论
为什么被折叠?



