Перейти к основному содержимому

method

activeLevel

activeLevel(value: ActiveLevelMode): IndoorBuildingMode
Parameters

array

array(value: AttributeValue[]): AttributeValue
Parameters

boolean

boolean(value: boolean): AttributeValue
Parameters

value

boolean
Returns

borders

borders(value: Borders): Range
Parameters

value

Returns

bySystem

bySystem(value: BySystem): MapAppearance
Parameters

calcPositionForGeometry

calcPositionForGeometry(camera: BaseCamera, geometry: Geometry, styleZoomToTiltRelation: StyleZoomToTiltRelation | null, screenArea: Padding | null, tilt: Tilt | null, bearing: Bearing | null, size: ScreenSize | null): CameraPosition
Parameters

camera

geometry

styleZoomToTiltRelation

screenArea

Padding|null

tilt

Tilt|null

bearing

Bearing|null

size

Returns

calcPositionForObjects

calcPositionForObjects(camera: BaseCamera, objects: SimpleMapObject[], styleZoomToTiltRelation: StyleZoomToTiltRelation | null, screenArea: Padding | null, tilt: Tilt | null, bearing: Bearing | null, size: ScreenSize | null): CameraPosition
Parameters

camera

objects

styleZoomToTiltRelation

screenArea

Padding|null

tilt

Tilt|null

bearing

Bearing|null

size

Returns

closed

closed(value: Closed): OpenStatus
Parameters

value

Returns

closingSoon

closingSoon(value: ClosingSoon): OpenStatus
Parameters

CompassControl

CompassControl(map: CompassControlProps): Element

A self-contained compass control that creates its own [CompassControlModel], subscribes to the bearing channel, and renders the compass UI.

Hidden when the map faces north; fades in/out with animation.

Parameters

map

Map instance from mapController.map.

Returns
Element

CompassControlView

CompassControlView(__namedParameters: CompassControlViewProps): Element

Presentational compass control — rotates to show the current bearing, fades out at north.

Parameters

__namedParameters

Returns
Element
CopyrightControl(props: CopyrightControlProps): Element

2GIS/URBI copyright logo — a plain View element rendered in JS, so it works identically on Android and iOS (no per-platform native view needed).

Subscribes to map.interactiveChannel, map.hideCopyrightChannel and map.productTypeChannel; hides itself when the map requests it and switches between the 2GIS/URBI logo depending on the product type baked into the license key. Tapping the logo opens the corresponding product's URL.

On iOS the logo is automatically offset by safeAreaInsets so it never sits under a notch, home indicator or status bar — the same way native iOS insets the copyright frame by safeAreaInsets and Android adds system-bar insets. The edgeInsets prop is added on top of the safe-area insets.

MapView renders this automatically (see its copyrightAlignment/ copyrightEdgeInsets/copyrightUriOpener props) — use this component directly only for custom compositions that bypass MapView's default overlay.

Parameters

props

Returns
Element

createDefaultMaxTiltRestriction

createDefaultMaxTiltRestriction(): StyleZoomToTiltRelation

Получаем стандартную зависимость максимального угла наклона от стилевого уровня масштабирования.

createDefaultStyleZoomToTiltRelation

createDefaultStyleZoomToTiltRelation(): StyleZoomToTiltRelation

Получение зависимости угла наклона камеры от стилевого уровня масштабирования для стандартного контроллера слежения за наклоном.

createStyleZoomToTiltRelation

createStyleZoomToTiltRelation(points: [StyleZoom, Tilt][]): StyleZoomToTiltRelation

Создаем зависимость угла наклона камеры от стилевого уровня масштабирования.

Parameters

points

[StyleZoom, Tilt][]

Точки, по которым строится зависимость.

Returns
StyleZoomToTiltRelation

зависимость угла наклона камеры от стилевого уровня масштабирования, если создать зависимость не удалось - бросаем исключение.

Зависимость должна представлять собой монотонную непрерывную функцию. Если точками задана зависимость, не удовлетворяющая условиям, то функция бросает исключение. Зависимость, примерно как в 2гис, можно задать последовательностью точек [(17, 0), (19, 15), (20, 25)] в режиме карты и [(15, 0), (16, 34), (17, 48)] в режиме навигатора. Пусть нужно получить значение угла наклона камеры T для стилевого уровня масштабирования Z, такого что Z0 < = Z < Z1 и зависимость задана точками [(Z0, T0), (Z1, T1)]. Тогда искомое значение рассчитывается по формуле T = T0 + k * (T1 - T0), где k = (Z - Z0) / (Z1 - Z0). Если Z < Z0, то T = T0. Если Z >= Z1, то T = T1.

data

data(value: number[]): AttributeValue
Parameters

value

number[]
Returns

defaultAppearance

defaultAppearance(): MapAppearance

Внешний вид карты по умолчанию: следование системной теме со стандартными светлой (default_theme) и тёмной (default_dark_theme) темами.

defaultAppearanceInverted

defaultAppearanceInverted(): MapAppearance

Внешний вид карты по умолчанию с перевёрнутыми темами: светлая тема в платформенном тёмном режиме и наоборот.

defaultSource

defaultSource(value: DefaultRasterUrlTemplate): RasterUrlTemplate
Parameters

directoryObject

directoryObject(value: DirectoryObject): SearchHistoryItem
Parameters

effectiveTheme

effectiveTheme(appearance: MapAppearance, isPlatformDarkMode: boolean): MapTheme

Тема карты, которую задаёт этот внешний вид: для BySystem - светлая или тёмная по платформенному тёмному режиму, для Fixed - всегда его тема, независимо от is_platform_dark_mode.

Parameters

appearance

isPlatformDarkMode

boolean
Returns

empty

empty(): AttributeValue

error

error(value: AddEventError): AddEventResult
Parameters

event

event(value: RoadEvent): AddEventResult
Parameters

eventCenter

eventCenter(value: GestureActionEventCenter): GestureActionPoint
Parameters

fixed

fixed(value: Fixed): MapAppearance
Parameters

value

Returns

flagFilter

flagFilter(value: FlagFilter): DynamicFilter
Parameters

fromAsset

fromAsset(value: CertificateFromAsset): Certificate
Parameters

fromAsset

fromAsset(value: KeyFromAsset): KeySource
Parameters

fromAsset

fromAsset(value: VendorConfigFromAsset): VendorConfig
Parameters

fromFile

fromFile(value: CertificateFromFile): Certificate
Parameters

fromFile

fromFile(value: KeyFromFile): KeySource
Parameters

fromFile

fromFile(value: VendorConfigFromFile): VendorConfig
Parameters

fromString

fromString(value: KeyFromString): KeySource
Parameters

fromString

fromString(value: VendorConfigFromString): VendorConfig
Parameters

geoPoint

geoPoint(value: GeoPoint): CategoryGeoContext
Parameters

geoPoint

geoPoint(value: GeoPoint): PointGeometryData
Parameters

geoPointWithElevation

geoPointWithElevation(value: GeoPointWithElevation): PointGeometryData
Parameters

geoRect

geoRect(value: GeoRect): CategoryGeoContext
Parameters

imageDataToDataUri

imageDataToDataUri(imageData: ImageData): string | null

Конвертирует ImageData из SDK в data:-URI для <Image> из React Native.

Parameters

imageData

Returns
stringnull

incompleteTextHandler

incompleteTextHandler(value: IncompleteTextHandler): SuggestHandler
Parameters

IndoorControl

IndoorControl(map: IndoorControlProps): Element

A self-contained indoor floor picker that creates its own [IndoorControlModel], subscribes to level channels, and renders the indoor UI.

Hidden when no indoor building is visible on the map.

Parameters

map

Map instance from mapController.map.

Returns
Element

IndoorControlView

IndoorControlView(__namedParameters: IndoorControlViewProps): Element | null

Presentational indoor control.

Parameters

__namedParameters

Returns
Elementnull

integer

integer(value: bigint): AttributeValue
Parameters

value

bigint
Returns

intervalSchedule

intervalSchedule(value: PublicTransportIntervalSchedule): PublicTransportSchedule
Parameters

isOpenAllDay

isOpenAllDay(value: IsOpenAllDay): WorkTimeFilter
Parameters

isOpenNow

isOpenNow(value: IsOpenNow): WorkTimeFilter
Parameters

location

location(value: AddressLocation): AddressComponent
Parameters

logicalPixel

logicalPixel(value: LogicalPixel): ModelSize
Parameters

makeCompassControlColors

makeCompassControlColors(colors?: MapControlsColors): CompassControlColors

Derives CompassControlColors from the base palette.

Parameters

makeIndoorControlColors

makeIndoorControlColors(colors?: MapControlsColors): IndoorControlColors

Derives IndoorControlColors from the base palette.

Parameters

makeMyLocationControlColors

makeMyLocationControlColors(colors?: MapControlsColors): MyLocationControlColors

Derives MyLocationControlColors from the base palette.

Parameters

makeTrafficControlColors

makeTrafficControlColors(colors?: MapControlsColors): TrafficControlColors

Derives TrafficControlColors from the base palette.

Parameters

makeZoomControlColors

makeZoomControlColors(colors?: MapControlsColors): ZoomControlColors

Derives ZoomControlColors from the base palette.

Parameters

mapPosition

mapPosition(value: GestureActionMapPosition): GestureActionPoint
Parameters

MapView

MapView(__namedParameters: MapViewProps): Element

React Native component that renders a 2GIS map.

Give it a controllerState (see useMapController) and an optional style (the map fills the component's bounds). While the map is being created the component shows a cover in the map's loading background color; the map appears once the controller is ready.

const controllerState = useMapController(context, options);
<MapView controllerState={controllerState} style={{ flex: 1 }} />

The copyright logo is a plain View element rendered in JS on top of the map surface (see CopyrightControl), so it renders identically on Android and iOS and is included automatically — no separate widget needs to be composed by the caller. The logo's visibility is driven entirely by the map's hideCopyrightChannel; use copyrightAlignment/copyrightEdgeInsets/ copyrightUriOpener to control its position and tap behaviour.

A MapController is backed by native map memory that the JavaScript garbage collector does not see — it only tracks the small JS wrapper. With little memory pressure on the JS side the collector may not run, so a controller can stay alive long after the last reference to it is gone, keeping its native memory held. Nothing in the SDK destroys a controller implicitly: to release the native memory deterministically, call destroy() yourself once the map is no longer needed, and only when nothing in your code references the controller anymore.

Parameters

__namedParameters

Returns
Element

MyLocationControl

MyLocationControl(map: MyLocationControlProps): Element

A self-contained my-location control that creates its own [MyLocationControlModel], subscribes to follow-state, enabled, and quality channels, and renders the UI.

The caller is responsible for:

  • Adding a MyLocationMapObjectSource to the map (to show the blue dot)
  • Handling permission requests via onPermissionRequest
Parameters

map

Map instance from mapController.map.

Returns
Element

MyLocationControlView

MyLocationControlView(__namedParameters: MyLocationControlViewProps): Element

Presentational my-location control.

Parameters

__namedParameters

Returns
Element

none

none(): VendorConfig

number

number(value: AddressNumber): AddressComponent
Parameters

number

number(value: number): AttributeValue
Parameters

value

number
Returns

object

object(value: [string, AttributeValue][]): AttributeValue
Parameters

value

[string, AttributeValue][]
Returns

objectHandler

objectHandler(value: SuggestObjectHandler): SuggestHandler
Parameters

opened

opened(value: Opened): OpenStatus
Parameters

value

Returns

openingSoon

openingSoon(value: OpeningSoon): OpenStatus
Parameters

orderedValues

orderedValues(value: OrderedValues): Range
Parameters

value

Returns

overview

overview(value: OverviewMode): IndoorBuildingMode
Parameters

parseGeoJson

parseGeoJson(geoJsonData: string): GeometryMapObject[]
Parameters

geoJsonData

string
Returns

parseGeoJsonFile

parseGeoJsonFile(fsPath: string): GeometryMapObject[]
Parameters

fsPath

string
Returns

performSearchHandler

performSearchHandler(value: PerformSearchHandler): SuggestHandler
Parameters

preciseSchedule

preciseSchedule(value: PublicTransportPreciseSchedule): PublicTransportSchedule
Parameters

projectionZToStyleZ

projectionZToStyleZ(projectionZ: Zoom, latitude: Latitude): StyleZoom
Parameters

projectionZ

latitude

Returns

rangeFilter

rangeFilter(value: RangeFilter): DynamicFilter
Parameters

readyMapController

readyMapController(controller: MapController): MapControllerState

Wraps an already created controller into a ready snapshot.

Parameters

scale

scale(value: ModelScale): ModelSize
Parameters

searchQuery

searchQuery(value: SearchQueryWithInfo): SearchHistoryItem
Parameters

sortingFilter

sortingFilter(value: SortingFilter): DynamicFilter
Parameters

streetAddress

streetAddress(value: AddressStreet): AddressComponent
Parameters

string

string(value: string): AttributeValue
Parameters

value

string
Returns

styleZToProjectionZ

styleZToProjectionZ(styleZ: StyleZoom, latitude: Latitude): Zoom
Parameters

styleZ

latitude

Returns

system

system(value: SystemCertificate): Certificate
Parameters

targetGeoPoint

targetGeoPoint(value: GestureActionTargetGeoPoint): GestureActionPoint
Parameters

TrafficControl

TrafficControl(map: TrafficControlProps): Element

A self-contained traffic control that creates its own [TrafficControlModel], subscribes to the state channel, and renders the traffic UI.

Hidden when traffic data is not available in the region.

Parameters

map

Map instance from mapController.map.

Returns
Element

TrafficControlView

TrafficControlView(__namedParameters: TrafficControlViewProps): Element | null

Presentational traffic control.

Parameters

__namedParameters

Returns
Elementnull

useCompassControlState

useCompassControlState(model: CompassControlModel | null): CompassControlState

Subscribes to CompassControlModel.bearingChannel and returns state + callback.

Parameters

useIndoorControlState

useIndoorControlState(model: IndoorControlModel | null): IndoorControlState

Subscribes to IndoorControlModel channels and returns state + callbacks.

Parameters

useMapController

useMapController(context: Context, options: MapControllerOptions): MapControllerState

Creates a map controller and publishes its lifecycle as a snapshot walking creatingready | error.

The hook never destroys a controller it has published. In the common case the map lives as long as the app and nobody has to. (The one exception is an orphan: creation finished after the hook was unmounted — such a controller was never visible to anyone and is destroyed immediately.) To release the native memory deterministically, call destroy() yourself at a moment when nothing uses the map anymore; an abandoned controller is reclaimed once the GC collects its wrapper.

options is an effect dependency: pass a memoized object (or a module-level constant). A fresh object literal on every render would recreate the map on every render, abandoning the previous controller each time.

Parameters

useMyLocationControlState

useMyLocationControlState(model: MyLocationControlModel | null, onPermissionRequest?: () => void): MyLocationControlState

Subscribes to MyLocationControlModel channels and returns state + callback.

onPermissionRequest is called when the button is pressed and the location quality is degraded (permission needed). The caller is responsible for requesting the actual platform permission.

Parameters

model

onPermissionRequest?

() => void
Returns

useTrafficControlState

useTrafficControlState(model: TrafficControlModel | null): TrafficControlStateResult

Subscribes to TrafficControlModel.stateChannel and returns state + callback.

Parameters

useZoomControlState

useZoomControlState(model: ZoomControlModel | null): ZoomControlState

Subscribes to ZoomControlModel channels and returns state + callbacks.

Parameters

wmsSource

wmsSource(value: WmsRasterUrlTemplate): RasterUrlTemplate
Parameters

workTime

workTime(value: WeekTime): WorkTimeFilter
Parameters

ZoomControl

ZoomControl(map: ZoomControlProps): Element

A self-contained zoom control that creates its own [ZoomControlModel], subscribes to SDK channels, and renders the zoom UI.

Parameters

map

Map instance from mapController.map.

Returns
Element

ZoomControlView

ZoomControlView(__namedParameters: ZoomControlViewProps): Element

Presentational zoom control.

Parameters

__namedParameters

Returns
Element

zoomOutToFitForGeometry

zoomOutToFitForGeometry(camera: BaseCamera, geometry: Geometry, styleZoomToTiltRelation?: StyleZoomToTiltRelation | null, size?: ScreenSize | null): CameraPosition
Parameters

camera

geometry

styleZoomToTiltRelation?

Default: null

size?

Default: null

Returns

zoomOutToFitForObjects

zoomOutToFitForObjects(camera: BaseCamera, objects: SimpleMapObject[], styleZoomToTiltRelation?: StyleZoomToTiltRelation | null, size?: ScreenSize | null): CameraPosition
Parameters

camera

objects

styleZoomToTiltRelation?

Default: null

size?

Default: null

Returns