@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.
@@ -0,0 +1,35 @@
1
+ # Troubleshooting
2
+
3
+ ## Build Fails Downloading Mapbox Dependencies
4
+
5
+ Check `MAPBOX_DOWNLOADS_TOKEN`:
6
+
7
+ - It must be a secret `sk...` token.
8
+ - It must include `DOWNLOADS:READ`.
9
+ - It must be available to native build steps (`gradle` and `pod install`).
10
+
11
+ ## Navigation Does Not Start
12
+
13
+ - Confirm destination coordinates are valid.
14
+ - Confirm location permissions are granted.
15
+ - Confirm `mapbox_access_token` resolves correctly in native resources/config.
16
+
17
+ ## iOS Starts in Preview-Like Camera
18
+
19
+ - Use `cameraMode: "following"`.
20
+ - Avoid forcing fixed camera behavior unless needed.
21
+ - Keep SDK adaptive camera enabled for turn-by-turn behavior.
22
+
23
+ ## No Banner/Progress Events
24
+
25
+ - Ensure listeners are registered before `startNavigation`.
26
+ - Verify active guidance is started (especially with simulation settings).
27
+
28
+ ## Android Uses External Navigation App
29
+
30
+ Current package behavior is native Mapbox navigation and should stay in-app.
31
+ If not, verify you are running the latest package version and rebuilt native code:
32
+
33
+ ```bash
34
+ npx expo prebuild --clean
35
+ ```
package/docs/USAGE.md ADDED
@@ -0,0 +1,100 @@
1
+ # Usage Guide
2
+
3
+ ## Start Full-Screen Navigation
4
+
5
+ ```ts
6
+ import { startNavigation } from "@atomiqlab/react-native-mapbox-navigation";
7
+
8
+ await startNavigation({
9
+ destination: { latitude: 37.7847, longitude: -122.4073, name: "Downtown" },
10
+ startOrigin: { latitude: 37.7749, longitude: -122.4194 },
11
+ shouldSimulateRoute: true,
12
+ routeAlternatives: true,
13
+ distanceUnit: "metric",
14
+ language: "en",
15
+ mute: false,
16
+ voiceVolume: 1,
17
+ cameraMode: "following",
18
+ cameraPitch: 45,
19
+ cameraZoom: 15,
20
+ uiTheme: "system",
21
+ mapStyleUriDay: "mapbox://styles/mapbox/navigation-day-v1",
22
+ mapStyleUriNight: "mapbox://styles/mapbox/navigation-night-v1",
23
+ showsSpeedLimits: true,
24
+ showsWayNameLabel: true,
25
+ showsTripProgress: true,
26
+ showsManeuverView: true,
27
+ showsActionButtons: true,
28
+ });
29
+ ```
30
+
31
+ ## Stop Navigation
32
+
33
+ ```ts
34
+ import { stopNavigation } from "@atomiqlab/react-native-mapbox-navigation";
35
+
36
+ await stopNavigation();
37
+ ```
38
+
39
+ ## Listen to Events
40
+
41
+ ```ts
42
+ import {
43
+ addLocationChangeListener,
44
+ addRouteProgressChangeListener,
45
+ addBannerInstructionListener,
46
+ addArriveListener,
47
+ addCancelNavigationListener,
48
+ addErrorListener,
49
+ } from "@atomiqlab/react-native-mapbox-navigation";
50
+
51
+ const subscriptions = [
52
+ addLocationChangeListener((location) => {
53
+ console.log("location", location.latitude, location.longitude);
54
+ }),
55
+ addRouteProgressChangeListener((progress) => {
56
+ console.log("progress", progress.fractionTraveled);
57
+ }),
58
+ addBannerInstructionListener((instruction) => {
59
+ console.log("banner", instruction.primaryText);
60
+ }),
61
+ addArriveListener((arrival) => {
62
+ console.log("arrive", arrival.name);
63
+ }),
64
+ addCancelNavigationListener(() => {
65
+ console.log("cancel");
66
+ }),
67
+ addErrorListener((error) => {
68
+ console.warn("navigation error", error.code, error.message);
69
+ }),
70
+ ];
71
+
72
+ // cleanup
73
+ subscriptions.forEach((sub) => sub.remove());
74
+ ```
75
+
76
+ ## Embedded Navigation View
77
+
78
+ ```tsx
79
+ import { MapboxNavigationView } from "@atomiqlab/react-native-mapbox-navigation";
80
+
81
+ export function EmbeddedNavigationScreen() {
82
+ return (
83
+ <MapboxNavigationView
84
+ style={{ flex: 1 }}
85
+ destination={{ latitude: 37.7847, longitude: -122.4073, name: "Downtown" }}
86
+ startOrigin={{ latitude: 37.7749, longitude: -122.4194 }}
87
+ shouldSimulateRoute
88
+ cameraMode="following"
89
+ onBannerInstruction={(instruction) => console.log(instruction.primaryText)}
90
+ onError={(error) => console.warn(error.message)}
91
+ />
92
+ );
93
+ }
94
+ ```
95
+
96
+ ## Platform Notes
97
+
98
+ - Android supports omitting `startOrigin` to start from current location.
99
+ - iOS supports omitting `startOrigin`; current location is resolved at runtime (with permission).
100
+ - Both platforms support embedded navigation view and camera/style customization.
@@ -0,0 +1,9 @@
1
+ {
2
+ "platforms": ["ios", "android"],
3
+ "ios": {
4
+ "modules": ["MapboxNavigationModule"]
5
+ },
6
+ "android": {
7
+ "modules": ["expo.modules.mapboxnavigation.MapboxNavigationModule"]
8
+ }
9
+ }
@@ -0,0 +1,31 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ # Must not collide with Mapbox's internal pod named "MapboxNavigationNative".
7
+ s.name = 'ExpoMapboxNavigationNative'
8
+ s.version = package['version']
9
+ s.summary = 'Native Mapbox Navigation module for Expo'
10
+ s.description = 'A custom Expo module that wraps the native Mapbox Navigation SDKs for iOS and Android.'
11
+ s.license = { :type => 'MIT' }
12
+ s.author = { 'author' => 'author@example.com' }
13
+ s.homepage = 'https://github.com/yourusername/react-native-mapbox-navigation'
14
+ s.platform = :ios, '14.0'
15
+ s.swift_version = '5.4'
16
+ s.source = { :git => 'https://github.com/yourusername/react-native-mapbox-navigation.git', :tag => s.version.to_s }
17
+ # Let CocoaPods choose linkage to avoid circular static-framework graphs
18
+ # with MapboxNavigation / MapboxCoreNavigation.
19
+ s.static_framework = false
20
+
21
+ s.dependency 'ExpoModulesCore'
22
+ s.dependency 'MapboxNavigation', '~> 2.19'
23
+
24
+ # Swift/Objective-C compatibility
25
+ s.pod_target_xcconfig = {
26
+ 'DEFINES_MODULE' => 'YES',
27
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule'
28
+ }
29
+
30
+ s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
31
+ end