diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..26137ae --- /dev/null +++ b/docs/install.md @@ -0,0 +1,219 @@ +--- +id: install +sidebar_position: 1 +title: Install +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Configure credentials + +Before installing @rnmapbox/maps you'll need to get the proper credentials. +You'll need: + - secret access token with (Downloads:Read) scope to download iOS and Android SDK from mapbox. + - public token to use as accessToken when running the app + +See [Configure Credential](https://docs.mapbox.com/ios/navigation/guides/get-started/install/#configure-credentials) on mapbox.com for details. + +# Install + + + + +```shell +npm install @rnmapbox/maps +``` + + + + +```shell +yarn add @rnmapbox/maps +``` + + + + +```shell +expo install @rnmapbox/maps +``` + + + + +# Configure @rnmapbox/maps + + + + + +### Update your podfile +Add the following to your `ios/Podfile` + +```ruby +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 +``` + +### Verify .netrc +Make sure your `.netrc` is configured with your secret access token, as described by the [mapbox docs](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials). To verify execute: + +```sh +grep -A 4 api.mapbox.com ~/.netrc +``` + +This should output something like: +```sh +machine api.mapbox.com + login mapbox + password sk.ey... +``` + + + + +### Adding mapbox maven repo + +Add the following to your android/build.gradle, into the section `allprojects/repositories` + +```gradle +// android/build.gradle + +allprojects { + repositories { + // ...other repos + maven { + url 'https://api.mapbox.com/downloads/v2/releases/maven' + authentication { + basic(BasicAuthentication) + } + credentials { + // Do not change the username below. + // This should always be `mapbox` (not your username). + username = 'mapbox' + // Use the secret token you stored in gradle.properties as the password + password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "" + } + } + // ...even more repos? + } +} +``` + +### Verify MAPBOX_DOWNLOADS_TOKEN in gradle.properties + +Make sure your global `.gradle-properties` is configured with your secret access token, as described by the [mapbox docs](https://docs.mapbox.com/android/maps/guides/install/#configure-credentials). To verify execute: + +```sh +grep -R MAPBOX_DOWNLOADS_TOKEN ~/.gradle/gradle.properties +``` + +This should output something like: +```sh +/Users/foo/.gradle/gradle.properties:MAPBOX_DOWNLOADS_TOKEN=sk.ey... +``` + + + + +### Plugin configuration + +Set `RNMapboxMapsDownloadToken` to your secret token. See the [credentials instructions](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials) on mapbox.com. + +Add `RNMapboxMapsDownloadToken` to the @rnmapbox/maps [config plugin](https://docs.expo.io/guides/config-plugins/) in the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.{json,config.js,config.ts}`: + + +```json +{ + "expo": { + "plugins": [ + [ + "@rnmapbox/maps", + { + "RNMapboxMapsDownloadToken": "sk.ey.." + } + ] + ] + } +} +``` + + + + +## Using V11 + +@rnmapbox 10.1 supports both `10.16.*` and `11.0.*` versions, but defaults to `10.16.*`. To use `11.0.*` please configure according to your platform: + + + + +Add the following to your `ios/Podfile` + +```ruby +$RNMapboxMapsVersion = '= 11.0.0' +``` + + + + +Set `RNMapboxMapsVersion` in `android/build.gradle` > `buildscript` > `ext` section + +```gradle +buildscript { + ext { + RNMapboxMapsVersion = '11.0.0' + } +} +``` + + + + +Add `RNMapboxMapsVersion` to the @rnmapbox/maps [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.{json,config.js,config.ts}`: + +```json +{ + "expo": { + "plugins": [ + [ + "@rnmapbox/maps", + { + ... + "RNMapboxMapsVersion": "11.0.0" + } + ] + ] + } +} +``` + + + + + +## Advanced - using non default version + +It's possible to overwrite the native SDK version with `RNMapboxMapsVersion`. But you have to revise it when upgrading `@rnmapbox/maps` as future `@rnmapbox/maps` releases might not support he version you set today. + +Follow the instructions above [on using v11](#using-v11), just use 10.* version you'd like. + diff --git a/docs/tutorial-extras/_category_.json b/docs/tutorial-extras/_category_.json deleted file mode 100644 index a8ffcc1..0000000 --- a/docs/tutorial-extras/_category_.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "label": "Tutorial - Extras", - "position": 3, - "link": { - "type": "generated-index" - } -} diff --git a/docs/tutorial-extras/img/docsVersionDropdown.png b/docs/tutorial-extras/img/docsVersionDropdown.png deleted file mode 100644 index 97e4164..0000000 Binary files a/docs/tutorial-extras/img/docsVersionDropdown.png and /dev/null differ diff --git a/docs/tutorial-extras/img/localeDropdown.png b/docs/tutorial-extras/img/localeDropdown.png deleted file mode 100644 index e257edc..0000000 Binary files a/docs/tutorial-extras/img/localeDropdown.png and /dev/null differ diff --git a/docusaurus.config.js b/docusaurus.config.js index 05a9efe..808cc56 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -25,7 +25,7 @@ const config = { trailingSlash: false, - onBrokenLinks: 'throw', + onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', // Even if you don't use internalization, you can use this field to set useful @@ -68,6 +68,11 @@ const config = { navbar: { title: '@rnmapbox/maps', items: [ + { + type: 'doc', + docId: 'install', + label: 'Install', + }, { type: 'docSidebar', sidebarId: 'examplesSidebar',