Note
MapLibre Native for Android is slightly peculiar in that it
requires setting an access token, even though it will be null
for
most users (only Mapbox authenticates this way). Even if it feels odd,
you have to have a line like this in your code before using the library.
You can put this near the top of your App.js
for convenience.
MapLibreGL.setAccessToken(null);
TODO: check if this is still an issue with MapLibre Native on Android (issue #21).
If you are hosting styles and sources on localhost, you might need to set the connection status manually for the SDK to be able to use them. See mapbox/mapbox-gl-native#12819.
Manually sets the connectivity state of the app, bypassing any checks to the
ConnectivityManager
. Set to true
for connected, false
for disconnected,
and null
for the normal ConnectivityManager
behavior.
import MapLibreGL from "@maplibre/maplibre-react-native";
MapLibreGL.setConnected(true);