@atomiqlab/react-native-mapbox-navigation 1.1.0 → 1.1.1

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.
Files changed (3) hide show
  1. package/README.md +43 -29
  2. package/app.plugin.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,25 +1,33 @@
1
1
  # @atomiqlab/react-native-mapbox-navigation
2
2
 
3
- Native Mapbox turn-by-turn navigation bridge for Expo / React Native (iOS + Android).
3
+ Native Mapbox turn-by-turn navigation for Expo apps on iOS and Android.
4
4
 
5
- ## Highlights
5
+ ## Features
6
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.
7
+ - Full-screen native navigation via `startNavigation`.
8
+ - Embedded native navigation UI via `MapboxNavigationView`.
9
+ - Real-time events: location, route progress, banner instruction, arrival, cancel, and error.
10
+ - Runtime controls for mute, voice volume, distance unit, and language.
11
+ - Navigation customization: camera mode/pitch/zoom, theme, map style, and UI visibility toggles.
12
+ - Expo config plugin that applies required Android and iOS native setup.
13
+
14
+ ## Requirements
15
+
16
+ - Expo SDK `>=50`
17
+ - iOS `14+`
18
+ - Mapbox access credentials:
19
+ - Public token (`pk...`)
20
+ - Downloads token (`sk...`) with `DOWNLOADS:READ`
12
21
 
13
22
  ## Installation
14
23
 
15
24
  ```bash
16
25
  npm install @atomiqlab/react-native-mapbox-navigation
17
- npx expo install expo-build-properties
18
26
  ```
19
27
 
20
- ## Expo Config
28
+ ## Expo Setup
21
29
 
22
- Add plugin in app config:
30
+ Add the plugin in your app config (`app.json` or `app.config.js`):
23
31
 
24
32
  ```json
25
33
  {
@@ -31,18 +39,18 @@ Add plugin in app config:
31
39
  }
32
40
  ```
33
41
 
34
- ### Required tokens
42
+ Set these environment variables:
35
43
 
36
- - `EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN`: Mapbox public token (`pk...`)
37
- - `MAPBOX_DOWNLOADS_TOKEN`: Mapbox downloads token (`sk...`) with `DOWNLOADS:READ`
44
+ - `EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN` (Mapbox public token)
45
+ - `MAPBOX_DOWNLOADS_TOKEN` (Mapbox downloads token)
38
46
 
39
- Then regenerate native projects:
47
+ Regenerate native projects:
40
48
 
41
49
  ```bash
42
50
  npx expo prebuild --clean
43
51
  ```
44
52
 
45
- ## Quick Usage
53
+ ## Quick Start
46
54
 
47
55
  ```ts
48
56
  import {
@@ -60,11 +68,14 @@ await startNavigation({
60
68
  destination: { latitude: 37.7847, longitude: -122.4073, name: "Downtown" },
61
69
  startOrigin: { latitude: 37.7749, longitude: -122.4194 },
62
70
  shouldSimulateRoute: true,
71
+ routeAlternatives: true,
63
72
  cameraMode: "following",
64
73
  uiTheme: "system",
74
+ distanceUnit: "metric",
75
+ language: "en",
65
76
  });
66
77
 
67
- const subs = [
78
+ const subscriptions = [
68
79
  addLocationChangeListener((location) => console.log(location)),
69
80
  addRouteProgressChangeListener((progress) => console.log(progress)),
70
81
  addBannerInstructionListener((instruction) => console.log(instruction.primaryText)),
@@ -74,11 +85,11 @@ const subs = [
74
85
  ];
75
86
 
76
87
  // Cleanup
77
- subs.forEach((sub) => sub.remove());
88
+ subscriptions.forEach((sub) => sub.remove());
78
89
  await stopNavigation();
79
90
  ```
80
91
 
81
- ## Embedded View
92
+ ## Embedded Navigation View
82
93
 
83
94
  ```tsx
84
95
  import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation";
@@ -89,13 +100,16 @@ import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation"
89
100
  startOrigin={{ latitude: 37.7749, longitude: -122.4194 }}
90
101
  shouldSimulateRoute
91
102
  cameraMode="following"
103
+ showsTripProgress
92
104
  onBannerInstruction={(instruction) => console.log(instruction.primaryText)}
105
+ onRouteProgressChange={(progress) => console.log(progress.fractionTraveled)}
106
+ onError={(error) => console.warn(error.message)}
93
107
  />;
94
108
  ```
95
109
 
96
- ## API Surface
110
+ ## API Overview
97
111
 
98
- ### Core functions
112
+ Core functions:
99
113
 
100
114
  - `startNavigation(options)`
101
115
  - `stopNavigation()`
@@ -106,7 +120,7 @@ import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation"
106
120
  - `setDistanceUnit(unit)`
107
121
  - `setLanguage(language)`
108
122
 
109
- ### Listener helpers
123
+ Event listeners:
110
124
 
111
125
  - `addLocationChangeListener(listener)`
112
126
  - `addRouteProgressChangeListener(listener)`
@@ -115,17 +129,17 @@ import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation"
115
129
  - `addCancelNavigationListener(listener)`
116
130
  - `addErrorListener(listener)`
117
131
 
118
- ### Key navigation options
132
+ Main `NavigationOptions` fields:
119
133
 
120
- - Routing: `destination`, `startOrigin`, `waypoints`, `routeAlternatives`, `shouldSimulateRoute`
134
+ - Route: `destination`, `startOrigin`, `waypoints`, `routeAlternatives`, `shouldSimulateRoute`
121
135
  - Camera: `cameraMode`, `cameraPitch`, `cameraZoom`
122
136
  - Theme/style: `uiTheme`, `mapStyleUri`, `mapStyleUriDay`, `mapStyleUriNight`
123
- - Guidance/UI: `distanceUnit`, `language`, `mute`, `voiceVolume`
124
- - Visibility toggles: `showsSpeedLimits`, `showsWayNameLabel`, `showsTripProgress`, `showsManeuverView`, `showsActionButtons`
137
+ - Guidance: `distanceUnit`, `language`, `mute`, `voiceVolume`
138
+ - UI toggles: `showsSpeedLimits`, `showsWayNameLabel`, `showsTripProgress`, `showsManeuverView`, `showsActionButtons`
125
139
 
126
- Full type reference: `src/MapboxNavigation.types.ts`
140
+ Full types: `src/MapboxNavigation.types.ts`
127
141
 
128
- ## Platform behavior
142
+ ## Platform Notes
129
143
 
130
- - Android: `startOrigin` optional; current location start is supported.
131
- - iOS: `startOrigin` optional; when omitted, the module resolves current device location (requires location permission).
144
+ - Android: `startOrigin` is optional (current location is supported).
145
+ - iOS: `startOrigin` is optional (current location is resolved at runtime with location permission).
package/app.plugin.js CHANGED
@@ -150,5 +150,5 @@ const withMapboxNavigation = (config) => {
150
150
  module.exports = createRunOncePlugin(
151
151
  withMapboxNavigation,
152
152
  "react-native-mapbox-navigation-plugin",
153
- "1.1.0"
153
+ "1.1.1"
154
154
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlab/react-native-mapbox-navigation",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Native Mapbox turn-by-turn navigation for Expo and React Native (iOS + Android)",
5
5
  "main": "src/index.tsx",
6
6
  "types": "src/index.tsx",