This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo 地图 iconExpo 地图

一个提供对 Android 上的 Google 地图和 iOS 上的 Apple 地图的访问的库。

Android
iOS
Recommended version:
~57.0.0

重要 此库目前处于 alpha 阶段,可能会频繁出现重大更改。 它在 Expo Go 应用中不可用 – 使用 开发版 来试用它。

安装

🌐 Installation

Terminal
npx expo install expo-maps

If you are installing this in an existing React Native app, make sure to install expo in your project.


观看:Expo 地图深度解析
观看:Expo 地图深度解析

使用 expo-maps 库将 Google 地图和 Apple 地图添加到你的 Expo 应用中。

配置

🌐 Configuration

Expo Maps 提供对 Android 和 iOS 上平台原生地图 API 的访问。

🌐 Expo Maps provides access to the platform native map APIs on Android and iOS.

  • Apple 地图(仅在
    iOS
    上可用)
    。安装此软件包后,无需额外配置即可使用。
  • Google 地图(仅在
    Android
    可用)
    。虽然 Google 为 iOS 提供了 Google Maps SDK,但 Expo Maps 仅在 Android 上支持它。如果你想在 iOS 上使用 Google 地图,你可以考虑使用替代库自己编写

Google Cloud API 设置

🌐 Google Cloud API setup

在你可以在 Android 上使用 Google 地图之前,你需要注册一个 Google Cloud API 项目,启用适用于 Android 的 Maps SDK,并将相关配置添加到你的 Expo 项目中。

在安卓上设置谷歌地图

如果你已经为 Android 上的其他 Google 服务(例如 Google 登录)注册了项目,请在你的项目上启用 Android 版 Maps SDK,然后跳到步骤 4。

1

注册一个 Google Cloud API 项目并启用 Android 的 Maps SDK

  • 打开你的浏览器访问 Google API 管理器 并创建一个项目。
  • 创建完成后,进入项目并启用Android 地图 SDK

2

复制你应用的 SHA-1 证书指纹

3

创建 API 密钥

  • 前往 Google Cloud 凭据管理器,点击 创建凭据,然后选择 API 密钥
  • 在弹出窗口中,点击 编辑 API 密钥
  • 关键限制 > 应用限制 下,选择 Android 应用
  • 限制使用于你的 Android 应用 下,点击 添加项目
  • 将你的 android.packageapp.json(例如:com.company.myapp)添加到包名字段中。
  • 然后,添加步骤 2 中 SHA-1 证书指纹 的值。
  • 点击 完成,然后点击 保存

4

将 API 密钥添加到你的项目中

  • 将你的 API 密钥 复制到 app.jsonandroid.config.googleMaps.apiKey 字段中。
  • 创建一个新的开发版本,现在你可以在 Android 上使用 expo-maps 的 Google 地图 API。

权限

🌐 Permissions

要在地图上显示用户的位置,你需要事先声明并请求位置权限。如果你的项目中使用了配置插件(Continuous Native Generation (CNG)),可以通过其内置的配置插件进行配置。该插件允许你配置一些无法在运行时设置、需要生成新的应用二进制文件才能生效的属性。如果你的应用使用 CNG,那么你需要手动配置该库。

🌐 To display the user's location on the map, you need to declare and request location permission beforehand. You can configure this using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.

Example app.json with config plugin

app.json
{ "expo": { "plugins": [ [ "expo-maps", { "requestLocationPermission": true, "locationPermission": "Allow $(PRODUCT_NAME) to use your location" } ] ] } }

Configurable properties

NameDefaultDescription
requestLocationPermissionfalse

A boolean to add permissions to AndroidManifest.xml and Info.plist.

locationPermission"Allow $(PRODUCT_NAME) to use your location"
Only for:
iOS

A string to set the NSLocationWhenInUseUsageDescription permission message.

用法

🌐 Usage

import { AppleMaps, GoogleMaps } from 'expo-maps'; import { Platform, Text } from 'react-native'; export default function App() { if (Platform.OS === 'ios') { return <AppleMaps.View style={{ flex: 1 }} />; } else if (Platform.OS === 'android') { return <GoogleMaps.View style={{ flex: 1 }} />; } else { return <Text>Maps are only available on Android and iOS</Text>; } }

自定义标记图标

🌐 Custom marker icons

你可以使用 expo-imageuseImage 钩子来加载自定义标记和注释图标。

🌐 You can use the useImage hook from expo-image to load custom marker and annotation icons.

以下示例显示了如何在 Android 上使用 Google 地图显示自定义标记图标。

🌐 The following example shows how to display a custom marker icon with Google Maps on Android.

import { useImage } from 'expo-image'; import { GoogleMaps } from 'expo-maps'; export default function Map() { const icon = useImage('https://example.com/marker.svg', { maxWidth: 48, maxHeight: 48 }); return ( <GoogleMaps.View style={{ flex: 1 }} markers={[ { coordinates: { latitude: 37.78825, longitude: -122.4324 }, icon: icon ?? undefined, anchor: { x: 0.5, y: 0.5 }, }, ]} /> ); }

GoogleMaps.Marker.icon 期望的是图片引用,例如由 expo-image 包中的 useImage hook 返回的值。它不直接接受图片源。

加载的图片尺寸决定标记大小,而不是标记样式属性。对于 SVG 图标,请在 SVG 中设置 widthheightviewBox,或将 maxWidthmaxHeight 传递给 useImage 钩子。你可以使用 anchor 将自定义图标与其坐标对齐。

🌐 The loaded image dimensions determine the marker size, not a marker style prop. For SVG icons, set width, height, and viewBox in the SVG, or pass maxWidth and maxHeight to the useImage hook. You can use anchor to align custom icons with their coordinates.

应用接口

🌐 API

import { AppleMaps, GoogleMaps } from 'expo-maps'; // AppleMaps.View and GoogleMaps.View are the React components

Components

AppleMapsView

Only for:
iOS

Type: React.Element<Component<Omit<AppleMapsViewProps, 'ref'>>>

AppleMapsViewProps

annotations

Only for:
iOS

Optional • Type: AppleMapsAnnotation[]

The array of annotations to display on the map.

cameraPosition

Only for:
iOS

Optional • Type: CameraPosition

The initial camera position of the map.

circles

Only for:
iOS

Optional • Type: AppleMapsCircle[]

The array of circles to display on the map.

colorScheme

Only for:
iOS

Optional • Type: AppleMapsColorScheme • Default: AppleMapsColorScheme.AUTOMATIC

Controls the color scheme (appearance) of the map. Use this to force the map to display in light or dark mode.

markers

Only for:
iOS

Optional • Type: AppleMapsMarker[]

The array of markers to display on the map.

onAnnotationClick

Only for:
iOS 18.0+

Optional • Type: (event: AppleMapsAnnotation) => void

Lambda invoked when the annotation is clicked.

onCameraMove

Only for:
iOS

Optional • Type: (event: CameraMoveEvent) => void

Lambda invoked when the map was moved by the user. Also runs once on initial mount with the starting viewport.

onCircleClick

Only for:
iOS 18.0+

Optional • Type: (event: AppleMapsCircle) => void

Lambda invoked when the circle is clicked.

onMapClick

Only for:
iOS

Optional • Type: (event: { coordinates: Coordinates }) => void

Lambda invoked when the user clicks on the map. It won't be invoked if the user clicks on POI or a marker.

onMarkerClick

Only for:
iOS 18.0+

Optional • Type: (event: AppleMapsMarker) => void

Lambda invoked when the marker is clicked.

onPolygonClick

Only for:
iOS 18.0+

Optional • Type: (event: AppleMapsPolygon) => void

Lambda invoked when the polygon is clicked.

onPolylineClick

Only for:
iOS 18.0+

Optional • Type: (event: AppleMapsPolyline) => void

Lambda invoked when the polyline is clicked.

polygons

Only for:
iOS

Optional • Type: AppleMapsPolygon[]

The array of polygons to display on the map.

polylines

Only for:
iOS

Optional • Type: AppleMapsPolyline[]

The array of polylines to display on the map.

properties

Only for:
iOS

Optional • Type: AppleMapsProperties

The properties for the map.

ref

Only for:
iOS

Optional • Type: Ref<AppleMapsViewType>

style

Only for:
iOS

Optional • Type: StyleProp<ViewStyle>

uiSettings

Only for:
iOS

Optional • Type: AppleMapsUISettings

The MapUiSettings to be used for UI-specific settings on the map.

GoogleMapsView

Only for:
Android

Type: React.Element<Component<Omit<GoogleMapsViewProps, 'ref'>>>

GoogleMapsViewProps

cameraPosition

Only for:
Android

Optional • Type: CameraPosition

The initial camera position of the map.

circles

Only for:
Android

Optional • Type: GoogleMapsCircle[]

The array of circles to display on the map.

colorScheme

Only for:
Android

Optional • Type: GoogleMapsColorScheme

Defines the color scheme for the map.

contentPadding

Only for:
Android

Optional • Type: GoogleMapsContentPadding

The padding values used to signal that portions of the map around the edges may be obscured. The map will move the Google logo, etc. to avoid overlapping the padding.

mapOptions

Only for:
Android

Optional • Type: GoogleMapsMapOptions

Defines configuration GoogleMapOptions for a GoogleMap

markers

Only for:
Android

Optional • Type: GoogleMapsMarker[]

The array of markers to display on the map.

onCameraMove

Only for:
Android

Optional • Type: (event: CameraMoveEvent) => void

Lambda invoked when the map was moved by the user. Also runs once on initial mount with the starting viewport.

onCircleClick

Only for:
Android

Optional • Type: (event: GoogleMapsCircle) => void

Lambda invoked when the circle is clicked.

onMapClick

Only for:
Android

Optional • Type: (event: { coordinates: Coordinates }) => void

Lambda invoked when the user clicks on the map. It won't be invoked if the user clicks on POI or a marker.

onMapLoaded

Only for:
Android

Optional • Type: () => void

Lambda invoked when the map is loaded.

onMapLongClick

Only for:
Android

Optional • Type: (event: { coordinates: Coordinates }) => void

Lambda invoked when the user long presses on the map.

onMarkerClick

Only for:
Android

Optional • Type: (event: GoogleMapsMarker) => void

Lambda invoked when the marker is clicked

onPOIClick

Only for:
Android

Optional • Type: (event: { coordinates: Coordinates, name: string }) => void

Lambda invoked when a POI is clicked.

onPolygonClick

Only for:
Android

Optional • Type: (event: GoogleMapsPolygon) => void

Lambda invoked when the polygon is clicked.

onPolylineClick

Only for:
Android

Optional • Type: (event: GoogleMapsPolyline) => void

Lambda invoked when the polyline is clicked.

polygons

Only for:
Android

Optional • Type: GoogleMapsPolygon[]

The array of polygons to display on the map.

polylines

Only for:
Android

Optional • Type: GoogleMapsPolyline[]

The array of polylines to display on the map.

properties

Only for:
Android

Optional • Type: GoogleMapsProperties

The properties for the map.

ref

Only for:
Android

Optional • Type: Ref<GoogleMapsViewType>

style

Only for:
Android

Optional • Type: StyleProp<ViewStyle>

uiSettings

Only for:
Android

Optional • Type: GoogleMapsUISettings

The MapUiSettings to be used for UI-specific settings on the map.

userLocation

Only for:
Android

Optional • Type: GoogleMapsUserLocation

User location, overrides default behavior.

GoogleStreetView

Only for:
Android

Type: React.Element<GoogleStreetViewProps>

GoogleStreetViewProps

isPanningGesturesEnabled

Only for:
Android

Optional • Type: boolean

isStreetNamesEnabled

Only for:
Android

Optional • Type: boolean

isUserNavigationEnabled

Only for:
Android

Optional • Type: boolean

isZoomGesturesEnabled

Only for:
Android

Optional • Type: boolean

position

Only for:
Android

style

Only for:
Android

Optional • Type: StyleProp<ViewStyle>

Hooks

useLocationPermissions(options)

ParameterType
options(optional)PermissionHookOptions<object>

Check or request permissions to access the location. This uses both requestPermissionsAsync and getPermissionsAsync to interact with the permissions.

Returns:
[PermissionResponse | null, RequestPermissionMethod<PermissionResponse>, GetPermissionMethod<PermissionResponse>]

Example

const [status, requestPermission] = useLocationPermissions();

Methods

Maps.getPermissionsAsync()

Returns:
Promise<PermissionResponse>

Maps.requestPermissionsAsync()

Returns:
Promise<PermissionResponse>

Types

AppleMapsAnnotation

Only for:
iOS

Type: AppleMapsMarker extended by:

PropertyTypeDescription
backgroundColor(optional)string

The background color of the annotation.

icon(optional)SharedRefType<'image'>

The custom icon to display in the annotation.

text(optional)string

The text to display in the annotation.

textColor(optional)string

The text color of the annotation.

AppleMapsCircle

Only for:
iOS

PropertyTypeDescription
centerCoordinates

The coordinates of the circle.

color(optional)ProcessedColorValue | string

The color of the circle.

id(optional)string

The unique identifier for the circle. This can be used to identify the clicked circle in the onCircleClick event.

lineColor(optional)ProcessedColorValue | string

The color of the circle line.

lineWidth(optional)number

The width of the circle line.

radiusnumber

The radius of the circle (in meters).

width(optional)number

The width of the circle.

AppleMapsMarker

Only for:
iOS

PropertyTypeDescription
coordinates(optional)Coordinates

The coordinates of the marker.

id(optional)string

The unique identifier for the marker. This can be used to identify the clicked marker in the onMarkerClick event.

monogram(optional)string
Only for:
iOS 17.0+

A short text (typically initials or 1-2 characters) to display on the marker balloon. This is mutually exclusive with systemImage. If both are provided, systemImage takes precedence.

systemImage(optional)string

The SF Symbol to display for the marker. This is mutually exclusive with monogram. If both are provided, systemImage takes precedence.

tintColor(optional)string

The tint color of the marker.

title(optional)string

The title of the marker, displayed in the callout when the marker is clicked.

AppleMapsPointOfInterestCategories

Only for:
iOS

PropertyTypeDescription
excluding(optional)AppleMapPointOfInterestCategory[]

The POI categories to exclude. To show all POIs, set this to an empty array.

including(optional)AppleMapPointOfInterestCategory[]

The POI categories to include. To hide all POIs, set this to an empty array.

AppleMapsPolygon

Only for:
iOS

PropertyTypeDescription
color(optional)ProcessedColorValue | string

The color of the polygon.

coordinatesCoordinates[]

The coordinates of the circle.

id(optional)string

The unique identifier for the polygon. This can be used to identify the clicked polygon in the onPolygonClick event.

lineColor(optional)ProcessedColorValue | string

The color of the polygon.

lineWidth(optional)number

The width of the polygon.

AppleMapsPolyline

Only for:
iOS

PropertyTypeDescription
color(optional)ProcessedColorValue | string

The color of the polyline.

contourStyle(optional)AppleMapsContourStyle

The style of the polyline.

coordinatesCoordinates[]

The coordinates of the polyline.

id(optional)string

The unique identifier for the polyline. This can be used to identify the clicked polyline in the onPolylineClick event.

width(optional)number

The width of the polyline.

AppleMapsProperties

Only for:
iOS

PropertyTypeDescription
elevation(optional)AppleMapsMapStyleElevation

Values you use to determine whether a map renders elevation.

emphasis(optional)AppleMapsMapStyleEmphasis

Values that control how the framework emphasizes map features.

isMyLocationEnabled(optional)boolean

Whether the user location is shown on the map.

Default:false
isTrafficEnabled(optional)boolean

Whether the traffic layer is enabled on the map.

mapType(optional)AppleMapsMapType

Defines which map type should be used.

pointsOfInterest(optional)AppleMapsPointOfInterestCategories

A structure you use to define points of interest to include or exclude on a map.

polylineTapThreshold(optional)number

The maximum distance in meters from a tap of a polyline for it to be considered a hit. If the distance is greater than the threshold, the polyline is not considered a hit. If a hit occurs, the onPolylineClick event will be triggered. Defaults to 20 meters.

selectionEnabled(optional)boolean

If true, the user can select a location on the map to get more information.

AppleMapsUISettings

Only for:
iOS

PropertyTypeDescription
compassEnabled(optional)boolean

Whether the compass is enabled on the map. If enabled, the compass is only visible when the map is rotated.

myLocationButtonEnabled(optional)boolean

Whether the my location button is visible.

scaleBarEnabled(optional)boolean

Whether the scale bar is displayed when zooming.

togglePitchEnabled(optional)boolean

Whether the user is allowed to change the pitch type.

AppleMapsViewType

Only for:
iOS

PropertyTypeDescription
openLookAroundAsync(coordinates: Coordinates) => Promise<void>

Opens the look around view at specified coordinates.

coordinates: Coordinates

The coordinates of the location to open the look around view at.

selectAnnotation(id: string, options: { moveCamera: boolean, zoom: number }) => void
Only for:
iOS 18.0+

Programmatically select an annotation by its ID.

id: string

The ID of the annotation to select, or undefined to clear selection.

options: { moveCamera: boolean, zoom: number }

Optional configuration for the selection.

selectMarker(id: string, options: { moveCamera: boolean, zoom: number }) => void
Only for:
iOS 18.0+

Programmatically select a marker by its ID.

id: string

The ID of the marker to select, or undefined to clear selection.

options: { moveCamera: boolean, zoom: number }

Optional configuration for the selection.

setCameraPosition(config: CameraPosition) => void

Update camera position. Animation duration is not supported on iOS.

config: CameraPosition

New camera postion.

CameraMoveEvent

The event payload for the onCameraMove callback on AppleMaps.View and GoogleMaps.View.

PropertyTypeDescription
bearingnumber

The bearing of the camera in degrees.

coordinatesCoordinates

The coordinates of the camera center.

latitudeDeltanumber

The height of the visible region in degrees of latitude

longitudeDeltanumber

The width of the visible region in degrees of longitude

tiltnumber

The tilt of the camera in degrees.

zoomnumber

The zoom level of the camera.

CameraPosition

PropertyTypeDescription
coordinates(optional)Coordinates

The middle point of the camera.

zoom(optional)number

The zoom level of the camera. For some view sizes, lower zoom levels might not be available.

Coordinates

PropertyTypeDescription
latitude(optional)number

The latitude of the coordinate.

longitude(optional)number

The longitude of the coordinate.

GoogleMapsAnchor

Only for:
Android

PropertyTypeDescription
xnumber

The normalized horizontal anchor point from 0.0 (left edge) to 1.0 (right edge).

ynumber

The normalized vertical anchor point from 0.0 (top edge) to 1.0 (bottom edge).

GoogleMapsCircle

Only for:
Android

PropertyTypeDescription
centerCoordinates

The coordinates of the circle.

clickCoordinates(optional)Coordinates

The geographic coordinates of the click point on the map.

color(optional)ProcessedColorValue | string

The color of the circle.

id(optional)string

The unique identifier for the circle. This can be used to identify the clicked circle in the onCircleClick event.

lineColor(optional)ProcessedColorValue | string

The color of the circle line.

lineWidth(optional)number

The width of the circle line.

radiusnumber

The radius of the circle.

GoogleMapsContentPadding

Only for:
Android

PropertyTypeDescription
bottom(optional)number

The padding on the bottom side of the map.

end(optional)number

In LTR contexts, end will be applied along the right edge. In RTL contexts, end will correspond to the left edge.

start(optional)number

In LTR contexts, start will be applied along the left edge. In RTL contexts, start will correspond to the right edge.

top(optional)number

The padding on the top side of the map.

GoogleMapsMapOptions

Only for:
Android

PropertyTypeDescription
mapId(optional)string

A map ID is a unique identifier that represents Google Map styling and configuration settings that are stored in Google Cloud.

GoogleMapsMapStyleOptions

Only for:
Android

PropertyTypeDescription
jsonstring

The JSON string of the map style options.

See: For creating map style options, see https://mapstyle.withgoogle.com/

GoogleMapsMarker

Only for:
Android

PropertyTypeDescription
anchor(optional)GoogleMapsAnchor

The anchor used to position the anchor relative to its coordinates.

Default:bottom-center of the icon
coordinates(optional)Coordinates

The coordinates of the marker.

draggable(optional)boolean

Whether the marker is draggable.

icon(optional)SharedRefType<'image'>

The custom icon to display for the marker.

id(optional)string

The unique identifier for the marker. This can be used to identify the clicked marker in the onMarkerClick event.

showCallout(optional)boolean

Whether the callout should be shown when the marker is clicked.

snippet(optional)string

The snippet of the marker, displayed in the callout when the marker is clicked.

title(optional)string

The title of the marker, displayed in the callout when the marker is clicked.

zIndex(optional)number

The z-index to use for the marker.

Default:0

GoogleMapsPolygon

Only for:
Android

PropertyTypeDescription
color(optional)ProcessedColorValue | string

The color of the polygon.

coordinatesCoordinates[]

The coordinates of the circle.

id(optional)string

The unique identifier for the polygon. This can be used to identify the clicked polygon in the onPolygonClick event.

lineColor(optional)ProcessedColorValue | string

The color of the polygon.

lineWidth(optional)number

The width of the polygon.

GoogleMapsPolyline

Only for:
Android

PropertyTypeDescription
color(optional)ProcessedColorValue | string

The color of the polyline.

coordinatesCoordinates[]

The coordinates of the polyline.

geodesic(optional)boolean

Whether the polyline is geodesic.

id(optional)string

The unique identifier for the polyline. This can be used to identify the clicked polyline in the onPolylineClick event.

width(optional)number

The width of the polyline.

GoogleMapsProperties

Only for:
Android

PropertyTypeDescription
isBuildingEnabled(optional)boolean

Whether the building layer is enabled on the map.

isIndoorEnabled(optional)boolean

Whether the indoor layer is enabled on the map.

isMyLocationEnabled(optional)boolean

Whether finding the user's location is enabled on the map.

isTrafficEnabled(optional)boolean

Whether the traffic layer is enabled on the map.

mapStyleOptions(optional)GoogleMapsMapStyleOptions

With style options you can customize the presentation of the standard Google map styles, changing the visual display of features like roads, parks, and other points of interest.

mapType(optional)GoogleMapsMapType

Defines which map type should be used.

maxZoomPreference(optional)number

The maximum zoom level for the map.

minZoomPreference(optional)number

The minimum zoom level for the map.

selectionEnabled(optional)boolean

If true, the user can select a location on the map to get more information.

GoogleMapsUISettings

Only for:
Android

PropertyTypeDescription
compassEnabled(optional)boolean

Whether the compass is enabled on the map. If enabled, the compass is only visible when the map is rotated.

indoorLevelPickerEnabled(optional)boolean

Whether the indoor level picker is enabled .

mapToolbarEnabled(optional)boolean

Whether the map toolbar is visible.

myLocationButtonEnabled(optional)boolean

Whether the my location button is visible.

rotationGesturesEnabled(optional)boolean

Whether rotate gestures are enabled.

scaleBarEnabled(optional)boolean

Whether the scale bar is displayed when zooming.

scrollGesturesEnabled(optional)boolean

Whether the scroll gestures are enabled.

scrollGesturesEnabledDuringRotateOrZoom(optional)boolean

Whether the scroll gestures are enabled during rotation or zoom.

tiltGesturesEnabled(optional)boolean

Whether the tilt gestures are enabled.

togglePitchEnabled(optional)boolean

Whether the user is allowed to change the pitch type.

zoomControlsEnabled(optional)boolean

Whether the zoom controls are visible.

zoomGesturesEnabled(optional)boolean

Whether the zoom gestures are enabled.

GoogleMapsUserLocation

Only for:
Android

PropertyTypeDescription
coordinatesCoordinates

User location coordinates.

followUserLocationboolean

Should the camera follow the users' location.

GoogleMapsViewType

Only for:
Android

PropertyTypeDescription
selectMarker(id: string, options: { moveCamera: boolean, zoom: number }) => Promise<void>

This is an async operation that animates the camera to the marker. If called rapidly, a previous animation may be cancelled, causing the returned promise to reject.

id: string

The ID of the marker to select, or undefined to clear selection.

options: { moveCamera: boolean, zoom: number }

Optional configuration for the selection.

setCameraPosition(config: SetCameraPositionConfig) => void

Update camera position.

config: SetCameraPositionConfig

New camera position config.

SetCameraPositionConfig

Only for:
Android

Type: CameraPosition extended by:

PropertyTypeDescription
duration(optional)number

The duration of the animation in milliseconds.

StreetViewCameraPosition

Only for:
Android

PropertyTypeDescription
bearing(optional)number
-
coordinatesCoordinates
-
tilt(optional)number
-
zoom(optional)number
-

Enums

AppleMapPointOfInterestCategory

Only for:
iOS

AIRPORT

AppleMapPointOfInterestCategory.AIRPORT = "AIRPORT"

AMUSEMENT_PARK

AppleMapPointOfInterestCategory.AMUSEMENT_PARK = "AMUSEMENT_PARK"

ANIMAL_SERVICE

AppleMapPointOfInterestCategory.ANIMAL_SERVICE = "ANIMAL_SERVICE"

AQUARIUM

AppleMapPointOfInterestCategory.AQUARIUM = "AQUARIUM"

ATM

AppleMapPointOfInterestCategory.ATM = "ATM"

AUTOMOTIVE_REPAIR

AppleMapPointOfInterestCategory.AUTOMOTIVE_REPAIR = "AUTOMOTIVE_REPAIR"

BAKERY

AppleMapPointOfInterestCategory.BAKERY = "BAKERY"

BANK

AppleMapPointOfInterestCategory.BANK = "BANK"

BASEBALL

AppleMapPointOfInterestCategory.BASEBALL = "BASEBALL"

BASKETBALL

AppleMapPointOfInterestCategory.BASKETBALL = "BASKETBALL"

BEACH

AppleMapPointOfInterestCategory.BEACH = "BEACH"

BEAUTY

AppleMapPointOfInterestCategory.BEAUTY = "BEAUTY"

BOWLING

AppleMapPointOfInterestCategory.BOWLING = "BOWLING"

BREWERY

AppleMapPointOfInterestCategory.BREWERY = "BREWERY"

CAFE

AppleMapPointOfInterestCategory.CAFE = "CAFE"

CAMPGROUND

AppleMapPointOfInterestCategory.CAMPGROUND = "CAMPGROUND"

CAR_RENTAL

AppleMapPointOfInterestCategory.CAR_RENTAL = "CAR_RENTAL"

CASTLE

AppleMapPointOfInterestCategory.CASTLE = "CASTLE"

CONVENTION_CENTER

AppleMapPointOfInterestCategory.CONVENTION_CENTER = "CONVENTION_CENTER"

DISTILLERY

AppleMapPointOfInterestCategory.DISTILLERY = "DISTILLERY"

EV_CHARGER

AppleMapPointOfInterestCategory.EV_CHARGER = "EV_CHARGER"

FAIRGROUND

AppleMapPointOfInterestCategory.FAIRGROUND = "FAIRGROUND"

FIRE_STATION

AppleMapPointOfInterestCategory.FIRE_STATION = "FIRE_STATION"

FISHING

AppleMapPointOfInterestCategory.FISHING = "FISHING"

FITNESS_CENTER

AppleMapPointOfInterestCategory.FITNESS_CENTER = "FITNESS_CENTER"

FOOD_MARKET

AppleMapPointOfInterestCategory.FOOD_MARKET = "FOOD_MARKET"

FORTRESS

AppleMapPointOfInterestCategory.FORTRESS = "FORTRESS"

GAS_STATION

AppleMapPointOfInterestCategory.GAS_STATION = "GAS_STATION"

GO_KART

AppleMapPointOfInterestCategory.GO_KART = "GO_KART"

GOLF

AppleMapPointOfInterestCategory.GOLF = "GOLF"

HIKING

AppleMapPointOfInterestCategory.HIKING = "HIKING"

HOSPITAL

AppleMapPointOfInterestCategory.HOSPITAL = "HOSPITAL"

HOTEL

AppleMapPointOfInterestCategory.HOTEL = "HOTEL"

KAYAKING

AppleMapPointOfInterestCategory.KAYAKING = "KAYAKING"

LANDMARK

AppleMapPointOfInterestCategory.LANDMARK = "LANDMARK"

LAUNDRY

AppleMapPointOfInterestCategory.LAUNDRY = "LAUNDRY"

LIBRARY

AppleMapPointOfInterestCategory.LIBRARY = "LIBRARY"

MAILBOX

AppleMapPointOfInterestCategory.MAILBOX = "MAILBOX"

MARINA

AppleMapPointOfInterestCategory.MARINA = "MARINA"

MINI_GOLF

AppleMapPointOfInterestCategory.MINI_GOLF = "MINI_GOLF"

MOVIE_THEATER

AppleMapPointOfInterestCategory.MOVIE_THEATER = "MOVIE_THEATER"

MUSEUM

AppleMapPointOfInterestCategory.MUSEUM = "MUSEUM"

MUSIC_VENUE

AppleMapPointOfInterestCategory.MUSIC_VENUE = "MUSIC_VENUE"

NATIONAL_MONUMENT

AppleMapPointOfInterestCategory.NATIONAL_MONUMENT = "NATIONAL_MONUMENT"

NATIONAL_PARK

AppleMapPointOfInterestCategory.NATIONAL_PARK = "NATIONAL_PARK"

NIGHTLIFE

AppleMapPointOfInterestCategory.NIGHTLIFE = "NIGHTLIFE"

PARK

AppleMapPointOfInterestCategory.PARK = "PARK"

PARKING

AppleMapPointOfInterestCategory.PARKING = "PARKING"

PHARMACY

AppleMapPointOfInterestCategory.PHARMACY = "PHARMACY"

PLANETARIUM

AppleMapPointOfInterestCategory.PLANETARIUM = "PLANETARIUM"

POLICE

AppleMapPointOfInterestCategory.POLICE = "POLICE"

POST_OFFICE

AppleMapPointOfInterestCategory.POST_OFFICE = "POST_OFFICE"

PUBLIC_TRANSPORT

AppleMapPointOfInterestCategory.PUBLIC_TRANSPORT = "PUBLIC_TRANSPORT"

RESTAURANT

AppleMapPointOfInterestCategory.RESTAURANT = "RESTAURANT"

RESTROOM

AppleMapPointOfInterestCategory.RESTROOM = "RESTROOM"

ROCK_CLIMBING

AppleMapPointOfInterestCategory.ROCK_CLIMBING = "ROCK_CLIMBING"

RV_PARK

AppleMapPointOfInterestCategory.RV_PARK = "RV_PARK"

SCHOOL

AppleMapPointOfInterestCategory.SCHOOL = "SCHOOL"

SKATE_PARK

AppleMapPointOfInterestCategory.SKATE_PARK = "SKATE_PARK"

SKATING

AppleMapPointOfInterestCategory.SKATING = "SKATING"

SKIING

AppleMapPointOfInterestCategory.SKIING = "SKIING"

SOCCER

AppleMapPointOfInterestCategory.SOCCER = "SOCCER"

SPA

AppleMapPointOfInterestCategory.SPA = "SPA"

STADIUM

AppleMapPointOfInterestCategory.STADIUM = "STADIUM"

STORE

AppleMapPointOfInterestCategory.STORE = "STORE"

SURFING

AppleMapPointOfInterestCategory.SURFING = "SURFING"

SWIMMING

AppleMapPointOfInterestCategory.SWIMMING = "SWIMMING"

TENNIS

AppleMapPointOfInterestCategory.TENNIS = "TENNIS"

THEATER

AppleMapPointOfInterestCategory.THEATER = "THEATER"

UNIVERSITY

AppleMapPointOfInterestCategory.UNIVERSITY = "UNIVERSITY"

VOLLEYBALL

AppleMapPointOfInterestCategory.VOLLEYBALL = "VOLLEYBALL"

WINERY

AppleMapPointOfInterestCategory.WINERY = "WINERY"

ZOO

AppleMapPointOfInterestCategory.ZOO = "ZOO"

AppleMapsColorScheme

Only for:
iOS

Controls the color scheme (appearance) of the map.

AUTOMATIC

AppleMapsColorScheme.AUTOMATIC = "AUTOMATIC"

The map follows the app's color scheme (light/dark mode).

DARK

AppleMapsColorScheme.DARK = "DARK"

The map is always displayed in dark mode.

LIGHT

AppleMapsColorScheme.LIGHT = "LIGHT"

The map is always displayed in light mode.

AppleMapsContourStyle

Only for:
iOS

The style of the polyline.

GEODESIC

AppleMapsContourStyle.GEODESIC = "GEODESIC"

A geodesic line.

STRAIGHT

AppleMapsContourStyle.STRAIGHT = "STRAIGHT"

A straight line.

AppleMapsMapStyleElevation

Only for:
iOS

AUTOMATIC

AppleMapsMapStyleElevation.AUTOMATIC = "AUTOMATIC"

The default elevation style, that renders a flat, 2D map.

FLAT

AppleMapsMapStyleElevation.FLAT = "FLAT"

A flat elevation style.

REALISTIC

AppleMapsMapStyleElevation.REALISTIC = "REALISTIC"

A value that renders a realistic, 3D map.

AppleMapsMapStyleEmphasis

Only for:
iOS

AUTOMATIC

AppleMapsMapStyleEmphasis.AUTOMATIC = "AUTOMATIC"

The default level of emphasis.

MUTED

AppleMapsMapStyleEmphasis.MUTED = "MUTED"

A muted emphasis style, that deemphasizes the map’s imagery.

AppleMapsMapType

Only for:
iOS

The type of map to display.

HYBRID

AppleMapsMapType.HYBRID = "HYBRID"

A satellite image of the area with road and road name layers on top.

IMAGERY

AppleMapsMapType.IMAGERY = "IMAGERY"

A satellite image of the area.

STANDARD

AppleMapsMapType.STANDARD = "STANDARD"

A street map that shows the position of all roads and some road names.

GoogleMapsColorScheme

Only for:
Android

DARK

GoogleMapsColorScheme.DARK = "DARK"

FOLLOW_SYSTEM

GoogleMapsColorScheme.FOLLOW_SYSTEM = "FOLLOW_SYSTEM"

LIGHT

GoogleMapsColorScheme.LIGHT = "LIGHT"

GoogleMapsMapType

Only for:
Android

The type of map to display.

HYBRID

GoogleMapsMapType.HYBRID = "HYBRID"

Satellite imagery with roads and points of interest overlayed.

NORMAL

GoogleMapsMapType.NORMAL = "NORMAL"

Standard road map.

SATELLITE

GoogleMapsMapType.SATELLITE = "SATELLITE"

Satellite imagery.

TERRAIN

GoogleMapsMapType.TERRAIN = "TERRAIN"

Topographic data.

权限

🌐 Permissions

安卓

🌐 Android

要在地图上显示用户的位置,expo-maps 库需要以下权限:

🌐 To show the user's location on the map, the expo-maps library requires the following permissions:

  • ACCESS_COARSE_LOCATION:用于近似设备位置
  • ACCESS_FINE_LOCATION:用于精确定位设备
Android PermissionDescription

ACCESS_COARSE_LOCATION

Allows an app to access approximate location.

Alternatively, you might want ACCESS_FINE_LOCATION.

ACCESS_FINE_LOCATION

Allows an app to access precise location.

Alternatively, you might want ACCESS_COARSE_LOCATION.

FOREGROUND_SERVICE

Allows a regular application to use Service.startForeground.

Allows a regular application to use Service.startForeground.

FOREGROUND_SERVICE_LOCATION

Allows a regular application to use Service.startForeground with the type "location".

Allows a regular application to use Service.startForeground with the type "location".

ACCESS_BACKGROUND_LOCATION

Allows an app to access location in the background.

If you're requesting this permission, you must also request either ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION. Requesting this permission by itself doesn't give you location access.

iOS

该库使用以下用法描述键:

🌐 The following usage description keys are used by this library:

Info.plist KeyDescription

NSLocationWhenInUseUsageDescription

A message that tells the user why the app is requesting access to the user’s location information while the app is running in the foreground.