MapView
The engine host: the map region and the single focus stop of the map. It
mounts the adapter the services build, without knowing which engine that
is, and provides the live map to children through useMap.
This is a function exported by @mapcairn/map, checked against version 0.2.0.
Signature
import { MapView } from "@mapcairn/map";
function MapView(input: MapViewProps): JSX.Element;
Parameters
{ initialView, basemap, onViewChange, onEngineError, onBasemapApplied, onBasemapError, onBasemapUnavailable, onClick, onLongPress, onPointerMove, onDropPinKey, onIdentifyKey, onEscape, onKeyCommand, keyHelp, cursor, children, id, chrome, testId, label, }input(MapViewProps)
Returns
JSX.Element
Remarks
- Keyboard and long-press are implemented here once, against the adapter; the engine's own key handling is turned off.
- A new basemap is swapped in on the mounted engine, keeping the centre, zoom and bearing. This component, its children and the chrome around it stay mounted.
- Server rendering produces the empty region only; no style attributes are
rendered, so it works under
style-src 'self'.data-zoomis written withsetAttributeonce the engine reports a zoom. - The host fills its parent;
MapChromeowns its placement. - The whole output, including
chrome, is inside the map context.