Skip to main content

MLRNModule

Methods

addCustomHeader(headerName, headerValue)

See Custom HTTP Headers

Arguments

NameTypeRequiredDescription
headerNamestringYesname for customHeader
headerValuestringYesvalue for customHeader

removeCustomHeader(headerName)

See Custom HTTP Headers

Arguments

NameTypeRequiredDescription
headerNamestringYesname of customHeader to be removed

requestAndroidLocationPermissions()

Android only, opens Location Permission prompt. Returns a Promise which resolves into a boolean. Either permission was granted or denied.

setConnected(connected)

Manually sets the connectivity state of the app. This is useful for apps which control their own connectivity state and want to bypass any checks to the ConnectivityManager. Set to true for connected, false for disconnected, and null for the ConnectivityManager to determine.

If hosting styles/sources on localhost, it's necessary to bypass ConnectivityManager when the device is offline (maplibre/maplibre-react-native#21, mapbox/mapbox-gl-native#12819):

setConnected(true);

For a low-data/offline app it's possible to block all style/source requests via network:

setConnected(false);

Arguments

NameTypeRequiredDescription
connectedbooleanYesWhether or not MapLibre Native should assume it is online