Migrating to v10
Remove setAccessToken(null)
Calling setAccessToken(null)
is obsolete now. Vendor specific access tokens should be set via style or tile URLs,
consult the corresponding provider docs if necessary.
- setAccessToken(null)
Changes to Camera
Component
Default animationMode
is now CameraMode.None
The default animationMode
for a controlled Camera
is now CameraMode.None
. To reinstate previous behavior, change
the following:
<Camera
centerCoordinates={[0, 0]}
+ animationDuration={2000}
+ animationMode="easeTo"
/>
Removed allowUpdates
and triggerKey
Props
If you need this functionality, keep your props stable or use the imperative setCamera
.
<Camera
centerCoordinates={[0, 0]}
- allowUpdates={false}
- triggerKey={someKey}
/>
MapView
props styleURL
and styleJSON
unified to mapStyle
The props styleURL
and styleJSON
, which control the style of the MapView
, have been unified into a single
mapStyle
prop.
styleURL
<MapView
- styleURL="https://some-style-url"
+ mapStyle="https://some-style-url"
/>
styleJSON
A style object is now expected as an object, without JSON.stringify
.
<MapView
- styleJSON={JSON.stringify(someStyleObject)}
+ mapStyle={someStyleObject}
/>
Removed Style
component
The Style
component was redundant, as it's possible to pass a style object to the MapView
directly.
- <MapView>
- <Style json={someStyleObject} />
- </MapView>
+ <MapView mapStyle={someStyleObject} />
Replaced OfflineProgressStatus
with OfflinePackStatus
The two types have been unified. Simply replace OfflineProgressStatus
with OfflinePackStatus
.
Removed deprecated Methods, Props and Types
UserTrackingModes
was removed, useUserTrackingMode
instead- Removed
setCamera
fromMapView
, use imperative methods ofCamera
instead - Removed
byId
methods from ShapeSource - Removed
children
from SymbolSource - Removed
assets
key fromImages
- Removed deprecated event keys
Deprecations
These breaking changes will occur in the next major release.
Default Export
The default export is deprecated. Choose between named imports or namespace imports instead. Adopt these to ease the transition to the future major release.
Named Imports
- import MapLibreGL from "@maplibre/maplibre-react-native";
+ import { MapView } from "@maplibre/maplibre-react-native";
- <MapLibreGL.MapView />
+ <MapView />
Namespace Import
- import MapLibreGL from "@maplibre/maplibre-react-native";
+ import * as MapLibreRN from "@maplibre/maplibre-react-native";
- <MapLibreGL.MapView />
+ <MapLibreRN.MapView />
Any namespace can be chosen, but using MapLibreGL
is not recommended anymore due to risk of confusion.
Module Exports
The camelCase module exports are deprecated, use PascalCase instead.
- import { locationManager, offlineManager, snapshotManager } from "@maplibre/maplibre-react-native";
+ import { LocationManager, OfflineManager, SnapshotManager } from "@maplibre/maplibre-react-native";