@atomiqlab/react-native-mapbox-navigation 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +46 -0
- package/README.md +131 -0
- package/android/build.gradle +64 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/expo/modules/mapboxnavigation/MapboxNavigationActivity.kt +421 -0
- package/android/src/main/java/expo/modules/mapboxnavigation/MapboxNavigationEventBridge.kt +18 -0
- package/android/src/main/java/expo/modules/mapboxnavigation/MapboxNavigationModule.kt +296 -0
- package/android/src/main/java/expo/modules/mapboxnavigation/MapboxNavigationViewManager.kt +143 -0
- package/app.plugin.js +154 -0
- package/docs/PUBLISHING.md +97 -0
- package/docs/TROUBLESHOOTING.md +35 -0
- package/docs/USAGE.md +100 -0
- package/expo-module.config.json +9 -0
- package/ios/ExpoMapboxNavigationNative.podspec +31 -0
- package/ios/MapboxNavigationModule.swift +613 -0
- package/ios/MapboxNavigationView.swift +298 -0
- package/package.json +75 -0
- package/scripts/verify-release.mjs +115 -0
- package/src/MapboxNavigation.types.ts +136 -0
- package/src/index.tsx +204 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
- Added iOS current-location fallback for full-screen `startNavigation` when `startOrigin` is omitted.
|
|
6
|
+
- Improved release readiness with `npm run verify` script (`tsc`, Android module compile, package dry-run).
|
|
7
|
+
- Added lightweight GitHub Actions CI workflow for package checks.
|
|
8
|
+
- Expanded docs with richer usage and troubleshooting guides.
|
|
9
|
+
- Tightened package publish surface to keep tarballs clean and focused.
|
|
10
|
+
|
|
11
|
+
## 1.0.0
|
|
12
|
+
|
|
13
|
+
- Added Android/iOS navigation module API with route, camera, style, and simulation options.
|
|
14
|
+
- Added event listeners for location, route progress, banner instructions, arrival, cancel, and errors.
|
|
15
|
+
- Added Android config plugin automation for repository/token wiring and required permissions.
|
|
16
|
+
- Added iOS config plugin defaults for location usage strings and background modes.
|
|
17
|
+
- Added runtime JS validation for coordinates in `startNavigation`.
|
|
18
|
+
- Added updated package docs (`README.md`, `QUICKSTART.md`) for developer onboarding.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ATOMIQ
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/QUICKSTART.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
## 1. Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @atomiqlab/react-native-mapbox-navigation
|
|
7
|
+
npx expo install expo-build-properties
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## 2. Configure plugin
|
|
11
|
+
|
|
12
|
+
In `app.json` / `app.config.js`:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"expo": {
|
|
17
|
+
"plugins": [
|
|
18
|
+
"@atomiqlab/react-native-mapbox-navigation"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 3. Set tokens
|
|
25
|
+
|
|
26
|
+
- Public token: `EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN=pk...`
|
|
27
|
+
- Downloads token: `MAPBOX_DOWNLOADS_TOKEN=sk...` (`DOWNLOADS:READ` required)
|
|
28
|
+
|
|
29
|
+
## 4. Regenerate native projects
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx expo prebuild --clean
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 5. Start navigation
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { startNavigation } from '@atomiqlab/react-native-mapbox-navigation';
|
|
39
|
+
|
|
40
|
+
await startNavigation({
|
|
41
|
+
destination: { latitude: 37.7847, longitude: -122.4073, name: 'Downtown' },
|
|
42
|
+
startOrigin: { latitude: 37.7749, longitude: -122.4194 },
|
|
43
|
+
shouldSimulateRoute: true,
|
|
44
|
+
cameraMode: 'following',
|
|
45
|
+
});
|
|
46
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @atomiqlab/react-native-mapbox-navigation
|
|
2
|
+
|
|
3
|
+
Native Mapbox turn-by-turn navigation bridge for Expo / React Native (iOS + Android).
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Full-screen native navigation (`startNavigation`).
|
|
8
|
+
- Embedded native navigation (`MapboxNavigationView`).
|
|
9
|
+
- Event stream: location, route progress, banner instruction, arrival, cancel, error.
|
|
10
|
+
- Flexible camera/theme/style controls.
|
|
11
|
+
- Expo config plugin for Android + iOS setup defaults.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @atomiqlab/react-native-mapbox-navigation
|
|
17
|
+
npx expo install expo-build-properties
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Expo Config
|
|
21
|
+
|
|
22
|
+
Add plugin in app config:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"expo": {
|
|
27
|
+
"plugins": [
|
|
28
|
+
"@atomiqlab/react-native-mapbox-navigation"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Required tokens
|
|
35
|
+
|
|
36
|
+
- `EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN`: Mapbox public token (`pk...`)
|
|
37
|
+
- `MAPBOX_DOWNLOADS_TOKEN`: Mapbox downloads token (`sk...`) with `DOWNLOADS:READ`
|
|
38
|
+
|
|
39
|
+
Then regenerate native projects:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx expo prebuild --clean
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Usage
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import {
|
|
49
|
+
startNavigation,
|
|
50
|
+
stopNavigation,
|
|
51
|
+
addLocationChangeListener,
|
|
52
|
+
addRouteProgressChangeListener,
|
|
53
|
+
addBannerInstructionListener,
|
|
54
|
+
addArriveListener,
|
|
55
|
+
addCancelNavigationListener,
|
|
56
|
+
addErrorListener,
|
|
57
|
+
} from "@atomiqlab/react-native-mapbox-navigation";
|
|
58
|
+
|
|
59
|
+
await startNavigation({
|
|
60
|
+
destination: { latitude: 37.7847, longitude: -122.4073, name: "Downtown" },
|
|
61
|
+
startOrigin: { latitude: 37.7749, longitude: -122.4194 },
|
|
62
|
+
shouldSimulateRoute: true,
|
|
63
|
+
cameraMode: "following",
|
|
64
|
+
uiTheme: "system",
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const subs = [
|
|
68
|
+
addLocationChangeListener((location) => console.log(location)),
|
|
69
|
+
addRouteProgressChangeListener((progress) => console.log(progress)),
|
|
70
|
+
addBannerInstructionListener((instruction) => console.log(instruction.primaryText)),
|
|
71
|
+
addArriveListener((arrival) => console.log(arrival)),
|
|
72
|
+
addCancelNavigationListener(() => console.log("cancelled")),
|
|
73
|
+
addErrorListener((error) => console.warn(error)),
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
// Cleanup
|
|
77
|
+
subs.forEach((sub) => sub.remove());
|
|
78
|
+
await stopNavigation();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Embedded View
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation";
|
|
85
|
+
|
|
86
|
+
<MapboxNavigationView
|
|
87
|
+
style={{ flex: 1 }}
|
|
88
|
+
destination={{ latitude: 37.7847, longitude: -122.4073, name: "Downtown" }}
|
|
89
|
+
startOrigin={{ latitude: 37.7749, longitude: -122.4194 }}
|
|
90
|
+
shouldSimulateRoute
|
|
91
|
+
cameraMode="following"
|
|
92
|
+
onBannerInstruction={(instruction) => console.log(instruction.primaryText)}
|
|
93
|
+
/>;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## API Surface
|
|
97
|
+
|
|
98
|
+
### Core functions
|
|
99
|
+
|
|
100
|
+
- `startNavigation(options)`
|
|
101
|
+
- `stopNavigation()`
|
|
102
|
+
- `isNavigating()`
|
|
103
|
+
- `getNavigationSettings()`
|
|
104
|
+
- `setMuted(muted)`
|
|
105
|
+
- `setVoiceVolume(volume)`
|
|
106
|
+
- `setDistanceUnit(unit)`
|
|
107
|
+
- `setLanguage(language)`
|
|
108
|
+
|
|
109
|
+
### Listener helpers
|
|
110
|
+
|
|
111
|
+
- `addLocationChangeListener(listener)`
|
|
112
|
+
- `addRouteProgressChangeListener(listener)`
|
|
113
|
+
- `addBannerInstructionListener(listener)`
|
|
114
|
+
- `addArriveListener(listener)`
|
|
115
|
+
- `addCancelNavigationListener(listener)`
|
|
116
|
+
- `addErrorListener(listener)`
|
|
117
|
+
|
|
118
|
+
### Key navigation options
|
|
119
|
+
|
|
120
|
+
- Routing: `destination`, `startOrigin`, `waypoints`, `routeAlternatives`, `shouldSimulateRoute`
|
|
121
|
+
- Camera: `cameraMode`, `cameraPitch`, `cameraZoom`
|
|
122
|
+
- Theme/style: `uiTheme`, `mapStyleUri`, `mapStyleUriDay`, `mapStyleUriNight`
|
|
123
|
+
- Guidance/UI: `distanceUnit`, `language`, `mute`, `voiceVolume`
|
|
124
|
+
- Visibility toggles: `showsSpeedLimits`, `showsWayNameLabel`, `showsTripProgress`, `showsManeuverView`, `showsActionButtons`
|
|
125
|
+
|
|
126
|
+
Full type reference: `src/MapboxNavigation.types.ts`
|
|
127
|
+
|
|
128
|
+
## Platform behavior
|
|
129
|
+
|
|
130
|
+
- Android: `startOrigin` optional; current location start is supported.
|
|
131
|
+
- iOS: `startOrigin` optional; when omitted, the module resolves current device location (requires location permission).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
group = 'expo.modules.mapboxnavigation'
|
|
5
|
+
version = '1.1.0'
|
|
6
|
+
|
|
7
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
8
|
+
apply from: expoModulesCorePlugin
|
|
9
|
+
applyKotlinExpoModulesCorePlugin()
|
|
10
|
+
|
|
11
|
+
def mapboxNavigationVersion = "2.21.0"
|
|
12
|
+
def mapboxDownloadsToken = (project.findProperty("MAPBOX_DOWNLOADS_TOKEN") ?: System.getenv("MAPBOX_DOWNLOADS_TOKEN") ?: "")
|
|
13
|
+
.toString()
|
|
14
|
+
.replace('"', '')
|
|
15
|
+
.trim()
|
|
16
|
+
|
|
17
|
+
android {
|
|
18
|
+
compileSdkVersion 35
|
|
19
|
+
|
|
20
|
+
defaultConfig {
|
|
21
|
+
minSdkVersion 24
|
|
22
|
+
targetSdkVersion 35
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
compileOptions {
|
|
26
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
27
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
kotlinOptions {
|
|
37
|
+
jvmTarget = '17'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
repositories {
|
|
42
|
+
mavenCentral()
|
|
43
|
+
maven {
|
|
44
|
+
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
|
45
|
+
authentication {
|
|
46
|
+
basic(BasicAuthentication)
|
|
47
|
+
}
|
|
48
|
+
credentials {
|
|
49
|
+
username = "mapbox"
|
|
50
|
+
password = mapboxDownloadsToken
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dependencies {
|
|
56
|
+
implementation project(':expo-modules-core')
|
|
57
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib"
|
|
58
|
+
implementation "androidx.activity:activity-ktx:1.8.2"
|
|
59
|
+
implementation "androidx.appcompat:appcompat:1.7.0"
|
|
60
|
+
|
|
61
|
+
// Mapbox Navigation SDK (NDK 27 artifacts for better native compatibility).
|
|
62
|
+
// Mapbox docs recommend -ndk27 variants when 16 KB page-size support is needed.
|
|
63
|
+
implementation "com.mapbox.navigation:ui-dropin-ndk27:$mapboxNavigationVersion"
|
|
64
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="expo.modules.mapboxnavigation">
|
|
2
|
+
<application>
|
|
3
|
+
<activity
|
|
4
|
+
android:name="expo.modules.mapboxnavigation.MapboxNavigationActivity"
|
|
5
|
+
android:exported="false"
|
|
6
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
|
7
|
+
</application>
|
|
8
|
+
</manifest>
|