Skip to content

Latest commit

 

History

History
121 lines (79 loc) · 3.53 KB

install.md

File metadata and controls

121 lines (79 loc) · 3.53 KB

iOS Installation

React-Native > 0.60.0

The following assumes, that you're using autolinking and installed

@rnmapbox/maps via npm or yarn.


The following is required for every following setup

Add the following to your ios/Podfile:

  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
    ... other pre install hooks
  end
  post_install do |installer|
    $RNMapboxMaps.post_install(installer)
    ... other post install hooks
  end

Set the $RNMapboxMapsImpl to mapbox aka v10 implementation see bellow for detailed instructions

Run pod install to download the proper mapbox dependency.

# Go to the ios folder
cd ios

# Run Pod Install
pod install

If you want to show the user's current location on the map with the UserLocation component, you'll need to add the following property to your Info.plist (see Mapbox iOS docs for more info):

<key>NSLocationWhenInUseUsageDescription</key>
<string>Show current location on map.</string>

You are good to go!

Read on if you want to edit your Mapbox version or flavor.


Mapbox Maps SDK (v10)

This is the version we recommend, while other implementations should work, we don't plan to support them in next version.

Check the current version of the SDK here.

Add the following to the beginning of your podfile

$RNMapboxMapsImpl = 'mapbox'

You can also override the version to use. Warning: if you set a version, then later update, the rnamapbox/maps library it's possible that you'll end up using Mapbox older version than supported. Make sure you revise this value with rnmapbox/maps updates.

# Warning: only for advanced use cases, only do this if you know what you're doing.
# $RNMapboxMapsVersion = '~> 10.12.0'

You will need to authorize your download of the Maps SDK with a secret access token with the DOWNLOADS:READ scope. This guide explains how to configure the secret token under section Configure your secret token.


Maplibre

MapLibre is an OSS fork of MapboxGL

Current default MapLibre version is 5.12.0

This is the default and requires no further setupios/Podfile

If you want to change the version used:

$RNMapboxMapsImpl = 'maplibre' # optional as this is the default
$RNMapboxMapsVersion = 'exactVersion 5.12.1'

MapLibre is consumed via Swift Package Manager, use RNMapboxMapsSwiftPackageManager to change other details than version

$RNMapboxMapsSwiftPackageManager = {
    url: "https://github.com/maplibre/maplibre-gl-native-distribution",
    requirement: {
      kind: "upToNextMajorVersion",
      minimumVersion: "5.12.1"
    },
    product_name: "Mapbox"
  }

Mapbox Maps GL SDK (9.0 or earlier)

This is the old version of mapbox gl (deprecated)

$RNMapboxMapsImpl = 'mapbox-gl'
$RNMapboxMapsVersion = '~> 5.9.0'

Mapbox Maps GL SDK > v6.0.0

If you are using version v6.0.0 of the SDK or later, you will need to authorize your download of the Maps SDK with a secret access token with the DOWNLOADS:READ scope. This guide explains how to configure the secret token under section Configure your secret token.