@jadamsbit/react-native-mapbox-navigation 1.0.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.
Files changed (117) hide show
  1. package/.gitattributes +1 -0
  2. package/CONTRIBUTING.md +11 -0
  3. package/LICENSE +21 -0
  4. package/README.md +357 -0
  5. package/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
  6. package/android/.gradle/7.3.3/checksums/md5-checksums.bin +0 -0
  7. package/android/.gradle/7.3.3/checksums/sha1-checksums.bin +0 -0
  8. package/android/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock +0 -0
  9. package/android/.gradle/7.3.3/dependencies-accessors/gc.properties +0 -0
  10. package/android/.gradle/7.3.3/executionHistory/executionHistory.lock +0 -0
  11. package/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
  12. package/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.3.3/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/vcs-1/gc.properties +0 -0
  17. package/android/README.md +14 -0
  18. package/android/build.gradle +99 -0
  19. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  20. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  21. package/android/gradle.properties +4 -0
  22. package/android/gradlew +244 -0
  23. package/android/gradlew.bat +92 -0
  24. package/android/src/main/AndroidManifest.xml +4 -0
  25. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationManager.kt +122 -0
  26. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationPackage.kt +16 -0
  27. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationView.kt +794 -0
  28. package/android/src/main/res/layout/navigation_view.xml +84 -0
  29. package/android/src/main/res/values/styles.xml +15 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +12 -0
  32. package/dist/typings.d.ts +40 -0
  33. package/dist/typings.js +1 -0
  34. package/example/.buckconfig +6 -0
  35. package/example/.eslintrc.js +4 -0
  36. package/example/.flowconfig +65 -0
  37. package/example/.prettierrc.js +7 -0
  38. package/example/.watchmanconfig +1 -0
  39. package/example/App.js +51 -0
  40. package/example/Gemfile +6 -0
  41. package/example/Gemfile.lock +100 -0
  42. package/example/NavigationComponent.js +56 -0
  43. package/example/__tests__/App-test.js +14 -0
  44. package/example/_bundle/config +2 -0
  45. package/example/_ruby-version +1 -0
  46. package/example/android/.gradle/8.2/checksums/checksums.lock +0 -0
  47. package/example/android/.gradle/8.2/fileChanges/last-build.bin +0 -0
  48. package/example/android/.gradle/8.2/fileHashes/fileHashes.lock +0 -0
  49. package/example/android/.gradle/8.2/gc.properties +0 -0
  50. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  51. package/example/android/app/_BUCK +55 -0
  52. package/example/android/app/build.gradle +232 -0
  53. package/example/android/app/build_defs.bzl +19 -0
  54. package/example/android/app/debug.keystore +0 -0
  55. package/example/android/app/proguard-rules.pro +10 -0
  56. package/example/android/app/src/debug/AndroidManifest.xml +13 -0
  57. package/example/android/app/src/debug/java/com/basicapp/ReactNativeFlipper.java +72 -0
  58. package/example/android/app/src/main/AndroidManifest.xml +30 -0
  59. package/example/android/app/src/main/java/com/basicapp/MainActivity.java +15 -0
  60. package/example/android/app/src/main/java/com/basicapp/MainApplication.java +81 -0
  61. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  62. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  63. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  64. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  65. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  66. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  67. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  68. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  69. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  70. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  71. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  72. package/example/android/app/src/main/res/values/strings.xml +3 -0
  73. package/example/android/app/src/main/res/values/styles.xml +9 -0
  74. package/example/android/build.gradle +55 -0
  75. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  76. package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  77. package/example/android/gradle.properties +35 -0
  78. package/example/android/gradlew +185 -0
  79. package/example/android/gradlew.bat +89 -0
  80. package/example/android/settings.gradle +6 -0
  81. package/example/app.json +4 -0
  82. package/example/babel.config.js +24 -0
  83. package/example/index.js +9 -0
  84. package/example/ios/BasicApp/AppDelegate.h +8 -0
  85. package/example/ios/BasicApp/AppDelegate.m +62 -0
  86. package/example/ios/BasicApp/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
  87. package/example/ios/BasicApp/Images.xcassets/Contents.json +6 -0
  88. package/example/ios/BasicApp/Info.plist +62 -0
  89. package/example/ios/BasicApp/LaunchScreen.storyboard +47 -0
  90. package/example/ios/BasicApp/main.m +9 -0
  91. package/example/ios/BasicApp-Bridging-Header.h +4 -0
  92. package/example/ios/BasicApp.xcodeproj/project.pbxproj +690 -0
  93. package/example/ios/BasicApp.xcodeproj/xcshareddata/xcschemes/BasicApp.xcscheme +88 -0
  94. package/example/ios/BasicApp.xcworkspace/contents.xcworkspacedata +10 -0
  95. package/example/ios/BasicApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  96. package/example/ios/BasicAppTests/BasicAppTests.m +65 -0
  97. package/example/ios/BasicAppTests/Info.plist +24 -0
  98. package/example/ios/BridgeHeader.swift +8 -0
  99. package/example/ios/Podfile +44 -0
  100. package/example/ios/Podfile.lock +473 -0
  101. package/example/metro.config.js +45 -0
  102. package/example/package.json +31 -0
  103. package/img/bridging-header.png +0 -0
  104. package/img/build-setting-linking.png +0 -0
  105. package/img/build-setting-path.png +0 -0
  106. package/ios/MapboxNavigation-Bridging-Header.h +3 -0
  107. package/ios/MapboxNavigation.xcodeproj/project.pbxproj +290 -0
  108. package/ios/MapboxNavigation.xcworkspace/contents.xcworkspacedata +7 -0
  109. package/ios/MapboxNavigation.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  110. package/ios/MapboxNavigationManager.m +20 -0
  111. package/ios/MapboxNavigationManager.swift +10 -0
  112. package/ios/MapboxNavigationView.swift +163 -0
  113. package/package.json +33 -0
  114. package/react-native-mapbox-navigation.podspec +51 -0
  115. package/src/index.tsx +21 -0
  116. package/src/typings.ts +43 -0
  117. package/tsconfig.json +14 -0
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.pbxproj -text
@@ -0,0 +1,11 @@
1
+ # Contributing
2
+
3
+ Contributing to this project should be as easy and transparent as possible.
4
+
5
+ ## Workflow
6
+
7
+ We use [GitHub Flow](https://guides.github.com/introduction/flow/), so all code changes happen through pull requests.
8
+
9
+ 1. Fork the repository and create your branch from `master`.
10
+ 2. If you've changed the functionality, update the documentation.
11
+ 3. Issue that pull request! :tada:
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jamie Adams
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/README.md ADDED
@@ -0,0 +1,357 @@
1
+ # React Native Mapbox Navigation
2
+
3
+ <!-- <img alt="React Native Mapbox Navigation" src="./img/ios-nav.png?v=2" width="300" align="right" /> -->
4
+
5
+ Smart Mapbox turn-by-turn routing based on real-time traffic for React Native. A navigation UI ready to drop into your React Native application.
6
+
7
+ ## Features
8
+
9
+ - A full-fledged turn-by-turn navigation UI for iPhone, iPad, and CarPlay that’s ready to drop into your application
10
+ - [Professionally designed map styles](https://www.mapbox.com/maps/) for daytime and nighttime driving
11
+ - Worldwide driving, cycling, and walking directions powered by [open data](https://www.mapbox.com/about/open/) and user feedback
12
+ - Traffic avoidance and proactive rerouting based on current conditions in [over 55 countries](https://docs.mapbox.com/help/how-mapbox-works/directions/#traffic-data)
13
+ - Natural-sounding turn instructions powered by [Amazon Polly](https://aws.amazon.com/polly/) (no configuration needed)
14
+ - Support for over two dozen languages
15
+
16
+ ## Installation Requirements
17
+
18
+ Before installing the SDK, you will need to gather the appropriate credentials. The SDK requires two pieces of sensitive information from your Mapbox account. If you don't have a Mapbox account: [sign up](https://account.mapbox.com/auth/signup/) and navigate to your [Account page](https://account.mapbox.com/). You'll need:
19
+
20
+ - **A public access token**: From your account's [tokens page](https://account.mapbox.com/access-tokens/), you can either copy your _default public token_ or click the **Create a token** button to create a new public token.
21
+ - **A secret access token with the `Downloads:Read` scope**.
22
+
23
+ 1. From your account's [tokens page](https://account.mapbox.com/access-tokens/), click the **Create a token** button.
24
+ 1. From the token creation page, give your token a name and make sure the box next to the `Downloads:Read` scope is checked.
25
+ 1. Click the **Create token** button at the bottom of the page to create your token.
26
+ 1. The token you've created is a _secret token_, which means you will only have one opportunity to copy it somewhere secure.
27
+
28
+ ## Installation
29
+
30
+ ```
31
+ yarn install @jadamsbit/react-native-mapbox-navigation
32
+ ```
33
+
34
+ Read the iOS specific instructions below before running `pod install`.
35
+
36
+ ---
37
+
38
+ ### iOS Specific Instructions
39
+
40
+ Make sure your react native project has an Objective-C bridging header for swift. If you don't have a bridging header you can follow these steps here below in the dropdown.
41
+
42
+ <details>
43
+ <summary>
44
+ Create an Objective-C bridging header
45
+ </summary>
46
+
47
+ 1. From Xcode, go to: <br>
48
+ File → New → File…
49
+ 1. Select Swift File
50
+ 1. Name your file Dummy or whatever you want
51
+ 1. In the Group dropdown, make sure to select the group folder for your app, not the project itself.
52
+
53
+ After you create the Swift file, you should be prompted to choose if you want to configure an Objective-C Bridging Header. Select “Create Bridging Header”.
54
+
55
+ ![bridging header](img/bridging-header.png)
56
+
57
+ This file is usually named YourProject-Bridging-Header.h. Don’t change this name manually, because Xcode configures the project with this exact filename.
58
+
59
+ </details>
60
+
61
+ There are a few build settings in Xcode that are necessary. Make sure to set `Don't Dead-strip Inits and Terms` to `YES` and `Dead Code Stripping` to `YES` for all projects/targets.
62
+
63
+ <details>
64
+ <summary>
65
+ Build Settings Screenshot 1
66
+ </summary>
67
+
68
+ ![build setting linking](img/build-setting-linking.png)
69
+
70
+ </details>
71
+
72
+ You will also need to remove the entry `"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"` from `Library Search Paths` if it is present for your project target -
73
+
74
+ <details>
75
+ <summary>
76
+ Build Settings Screenshot 2
77
+ </summary>
78
+
79
+ ![build setting path](img/build-setting-path.png)
80
+
81
+ </details>
82
+
83
+ Place your public token in your Xcode project's `Info.plist` and add a `MBXAccessToken` key whose value is your public access token.
84
+
85
+ NOTE: `MGLMapboxAccessToken` is deprecated, now you should use `MBXAccessToken` instead
86
+
87
+ Add the `UIBackgroundModes` key to `Info.plist` with `audio` and `location` if it is not already present. This will allow your app to deliver audible instructions while it is in the background or the device is locked.
88
+
89
+ ```
90
+ <key>UIBackgroundModes</key>
91
+ <array>
92
+ <string>audio</string>
93
+ <string>location</string>
94
+ </array>
95
+ ```
96
+
97
+ Place your secret token in a `.netrc` file in your OS home directory that contains this:
98
+
99
+ ```
100
+ machine api.mapbox.com
101
+ login mapbox
102
+ password <INSERT SECRET TOKEN>
103
+ ```
104
+
105
+ Add the following to your ios podfile -
106
+
107
+ ```ruby
108
+ pre_install do |installer|
109
+ $RNMBNAV.pre_install(installer)
110
+ # any other pre install hooks here
111
+ end
112
+
113
+ post_install do |installer|
114
+ $RNMBNAV.post_install(installer)
115
+ # any other post install hooks here
116
+ end
117
+ ```
118
+
119
+ <details>
120
+ <summary>podfile example</summary>
121
+
122
+ ```ruby
123
+ require_relative '../node_modules/react-native/scripts/react_native_pods'
124
+ require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
125
+
126
+ platform :ios, '10.0'
127
+ install! 'cocoapods', :disable_input_output_paths => true
128
+
129
+ target 'AwesomeProject' do
130
+ config = use_native_modules!
131
+
132
+ use_react_native!(:path => config["reactNativePath"])
133
+
134
+ target 'AwesomeProjectTests' do
135
+ inherit! :complete
136
+ # Pods for testing
137
+ end
138
+
139
+ pre_install do |installer|
140
+ $RNMBNAV.pre_install(installer)
141
+ end
142
+
143
+ # Enables Flipper.
144
+ #
145
+ # Note that if you have use_frameworks! enabled, Flipper will not work and
146
+ # you should disable these next few lines.
147
+ use_flipper!
148
+ post_install do |installer|
149
+ flipper_post_install(installer)
150
+ $RNMBNAV.post_install(installer)
151
+ end
152
+ end
153
+
154
+ target 'AwesomeProject-tvOS' do
155
+ # Pods for AwesomeProject-tvOS
156
+
157
+ target 'AwesomeProject-tvOSTests' do
158
+ inherit! :search_paths
159
+ # Pods for testing
160
+ end
161
+ end
162
+ ```
163
+
164
+ </details>
165
+
166
+ Now you are ready to install the cocoapod:
167
+
168
+ ```
169
+ cd ios && pod install
170
+ ```
171
+
172
+ If you are experiencing a _"multiple commands produce"_ build error in your Xcode project then you will need to add this entry below to the top of your ios podfile:
173
+
174
+ `install! 'cocoapods', :disable_input_output_paths => true`
175
+
176
+ If you are having an issue with your archive not showing up in organizer after archiving then you will need to open `ios/Pods/Target Support Files/@react-native-mapbox-gl-mapbox-static/@react-native-mapbox-gl-mapbox-static-copy-dsyms.sh` and comment out lines 85 thru 89 -
177
+
178
+ <details>
179
+ <summary>
180
+ Lines 85 thru 89
181
+ </summary>
182
+
183
+ ```sh
184
+ #install_dsym "${PODS_ROOT}/@react-native-mapbox-gl-mapbox-static/dynamic/MapboxMobileEvents.framework.dSYM"
185
+ #install_bcsymbolmap "${PODS_ROOT}/@react-native-mapbox-gl-mapbox-static/dynamic/93C58D95-90B9-30C8-8F60-4BDE32FD7E8E.bcsymbolmap"
186
+ #install_bcsymbolmap "${PODS_ROOT}/@react-native-mapbox-gl-mapbox-static/dynamic/BB87D8DD-493F-37AA-BD21-2BC609B8311B.bcsymbolmap"
187
+ #install_bcsymbolmap "${PODS_ROOT}/@react-native-mapbox-gl-mapbox-static/dynamic/B184533A-B4A2-3D2F-AD72-A6C33D9914F4.bcsymbolmap"
188
+ #install_bcsymbolmap "${PODS_ROOT}/@react-native-mapbox-gl-mapbox-static/dynamic/E2FE4B9E-73E5-34BF-B8B9-8FECEBE04D8D.bcsymbolmap"
189
+ ```
190
+
191
+ </details>
192
+
193
+ For more information you can read the [docs provided by Mapbox](https://docs.mapbox.com/ios/navigation/overview/#configure-credentials).
194
+
195
+ ---
196
+
197
+ ### Android Specific Instructions
198
+
199
+ Place your secret token in your android app's top level `gradle.properties` file:
200
+
201
+ ```
202
+ MAPBOX_DOWNLOADS_TOKEN=SECRET_TOKEN_HERE
203
+ ```
204
+
205
+ Open up your _project-level_ `build.gradle` file. Declare the Mapbox Downloads API's `releases/maven` endpoint in the `repositories` block.
206
+
207
+ ```gradle
208
+ allprojects {
209
+ repositories {
210
+ maven {
211
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
212
+ authentication {
213
+ basic(BasicAuthentication)
214
+ }
215
+ credentials {
216
+ // Do not change the username below.
217
+ // This should always be `mapbox` (not your username).
218
+ username = "mapbox"
219
+ // Use the secret token you stored in gradle.properties as the password
220
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
221
+ }
222
+ }
223
+ }
224
+ }
225
+ ```
226
+
227
+ Place your public token in your project's `android/app/src/main/AndroidManifest.xml`
228
+
229
+ ```xml
230
+ <!-- This should be a child of the application tag -->
231
+ <meta-data android:name="MAPBOX_ACCESS_TOKEN"
232
+ android:value="PUBLIC_TOKEN_HERE" />
233
+ ```
234
+
235
+ For more information you can read the [docs provided by Mapbox](https://docs.mapbox.com/android/navigation/overview/#configure-credentials).
236
+
237
+ ## Usage
238
+
239
+ ```jsx
240
+ import * as React from "react";
241
+ import { StyleSheet, View } from "react-native";
242
+ import MapboxNavigation from "@jadamsbit/react-native-mapbox-navigation";
243
+
244
+ export const SomeComponent = () => {
245
+ return (
246
+ <View style={styles.container}>
247
+ <MapboxNavigation
248
+ origin={[-97.760288, 30.273566]}
249
+ destination={[-97.918842, 30.494466]}
250
+ shouldSimulateRoute
251
+ showsEndOfRouteFeedback
252
+ onLocationChange={(event) => {
253
+ const { latitude, longitude } = event.nativeEvent;
254
+ }}
255
+ onRouteProgressChange={(event) => {
256
+ const {
257
+ distanceTraveled,
258
+ durationRemaining,
259
+ fractionTraveled,
260
+ distanceRemaining,
261
+ } = event.nativeEvent;
262
+ }}
263
+ onError={(event) => {
264
+ const { message } = event.nativeEvent;
265
+ }}
266
+ onCancelNavigation={() => {
267
+ // User tapped the "X" cancel button in the nav UI
268
+ // or canceled via the OS system tray on android.
269
+ // Do whatever you need to here.
270
+ }}
271
+ onArrive={() => {
272
+ // Called when you arrive at the destination.
273
+ }}
274
+ />
275
+ </View>
276
+ );
277
+ };
278
+
279
+ const styles = StyleSheet.create({
280
+ container: {
281
+ flex: 1,
282
+ },
283
+ });
284
+ ```
285
+
286
+ ### `MapboxNavigation` Props
287
+
288
+ #### `origin` (**Required**)
289
+
290
+ Array that contains the longitude and latitude for the starting point.<br>
291
+ `[$longitude, $latitude]`
292
+
293
+ #### `destination` (**Required**)
294
+
295
+ Array that contains the longitude and latitude for the destination point.<br>
296
+ `[$longitude, $latitude]`
297
+
298
+ #### `waypoints`
299
+
300
+ Array that contains arrays of longitude and latitude for the waypoints (limit 25 as per the MapBox restrictions).<br>
301
+ `[[$longitude, $latitude], [$longitude, $latitude]]`
302
+
303
+ #### `shouldSimulateRoute`
304
+
305
+ Boolean that controls route simulation. Set this as `true` to auto navigate which is useful for testing or demo purposes. Defaults to `false`.
306
+
307
+ #### `showsEndOfRouteFeedback`
308
+
309
+ Boolean that controls showing the end of route feedback UI when the route controller arrives at the final destination. Defaults to `false`. Currently this prop is only available for iOS as the Android Mapbox SDK does not support drop-in UI for this functionality. Will need to implement this manually in Android.
310
+
311
+ #### `mute`
312
+
313
+ Boolean that toggles voice instructions. Defaults to `false`.
314
+
315
+ #### `hideStatusView`
316
+
317
+ Boolean that controls showing the `StatusView` (iOS only). This is the transparent black bar with the "Simulating Navigation" text shown in the above screenshot. Defaults to `false`.
318
+
319
+ #### `vehicleMaxWidth`
320
+
321
+ Number that sets max width (in meters) of the vehicle. Defaults to `1.6`.
322
+
323
+ #### `vehicleMaxHeight`
324
+
325
+ Number that sets max height (in meters) of the vehicle. Defaults to `1.9`.
326
+
327
+ #### `mute`
328
+
329
+ Boolean that toggles voice instructions. Defaults to `false`.
330
+
331
+ #### `onLocationChange`
332
+
333
+ Function that is called frequently during route navigation. It receives `latitude` and `longitude` as parameters that represent the current location during navigation.
334
+
335
+ #### `onRouteProgressChange`
336
+
337
+ Function that is called frequently during route navigation. It receives `distanceTraveled`, `durationRemaining`, `fractionTraveled`, and `distanceRemaining` as parameters.
338
+
339
+ #### `onError`
340
+
341
+ Function that is called whenever an error occurs. It receives a `message` parameter that describes the error that occurred.
342
+
343
+ #### `onCancelNavigation`
344
+
345
+ Function that is called whenever a user cancels navigation.
346
+
347
+ #### `onArrive`
348
+
349
+ Function that is called when you arrive at the provided destination.
350
+
351
+ ## Contributing
352
+
353
+ Contributions are very welcome. Please check out the [contributing document](CONTRIBUTING.md).
354
+
355
+ ## License
356
+
357
+ The source code in this library is [MIT](LICENSE) licensed. The usage of this library will fall under Mapbox terms (this library downloads Mapbox SDKs and uses that closed source in conjunction with the open source code here).
File without changes
@@ -0,0 +1,2 @@
1
+ #Wed Mar 06 16:54:35 EST 2024
2
+ gradle.version=7.3.3
File without changes
@@ -0,0 +1,14 @@
1
+ README
2
+ ======
3
+
4
+ If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5
+
6
+ 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7
+ 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8
+ ```
9
+ ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10
+ sdk.dir=/Users/{username}/Library/Android/sdk
11
+ ```
12
+ 3. Delete the `maven` folder
13
+ 4. Run `./gradlew installArchives`
14
+ 5. Verify that latest set of generated files is in the maven folder with the correct version number
@@ -0,0 +1,99 @@
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["MapboxNavigation_kotlinVersion"]
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:7.2.2"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ def isNewArchitectureEnabled() {
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
+ }
20
+
21
+ apply plugin: "com.android.library"
22
+ apply plugin: "kotlin-android"
23
+
24
+
25
+ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
26
+
27
+ if (isNewArchitectureEnabled()) {
28
+ apply plugin: "com.facebook.react"
29
+ }
30
+
31
+ def getExtOrDefault(name) {
32
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["MapboxNavigation_" + name]
33
+ }
34
+
35
+ def getExtOrIntegerDefault(name) {
36
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["MapboxNavigation_" + name]).toInteger()
37
+ }
38
+
39
+ android {
40
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
41
+
42
+ defaultConfig {
43
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
44
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
45
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
46
+ }
47
+ buildTypes {
48
+ release {
49
+ minifyEnabled false
50
+ }
51
+ }
52
+
53
+ lintOptions {
54
+ disable "GradleCompatible"
55
+ }
56
+
57
+ compileOptions {
58
+ sourceCompatibility JavaVersion.VERSION_1_8
59
+ targetCompatibility JavaVersion.VERSION_1_8
60
+ }
61
+
62
+ // Add the block below if you're using Kotlin
63
+ kotlinOptions {
64
+ jvmTarget = "1.8"
65
+ }
66
+
67
+ buildFeatures {
68
+ viewBinding true
69
+ }
70
+
71
+ }
72
+
73
+ repositories {
74
+ mavenCentral()
75
+ google()
76
+ }
77
+
78
+ def kotlin_version = getExtOrDefault("kotlinVersion")
79
+
80
+ dependencies {
81
+ // For < 0.71, this will be from the local maven repo
82
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
83
+ //noinspection GradleDynamicVersion
84
+ implementation "com.facebook.react:react-native:+"
85
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
86
+
87
+ // mapbox dependencies
88
+ implementation "com.mapbox.navigation:android:2.17.8"
89
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
90
+ implementation 'androidx.cardview:cardview:1.0.0'
91
+ }
92
+
93
+ if (isNewArchitectureEnabled()) {
94
+ react {
95
+ jsRootDir = file("../src/")
96
+ libraryName = "MapboxNavigationView"
97
+ codegenJavaPackageName = "com.jadamsbit.mapboxnavigation"
98
+ }
99
+ }
@@ -0,0 +1,7 @@
1
+ #Mon Feb 12 09:11:13 IST 2024
2
+ distributionBase=GRADLE_USER_HOME
3
+ distributionPath=wrapper/dists
4
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
5
+ networkTimeout=10000
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,4 @@
1
+ MapboxNavigation_kotlinVersion=1.6.0
2
+ MapboxNavigation_compileSdkVersion=33
3
+ MapboxNavigation_minSdkVersion=21
4
+ MapboxNavigation_targetSdkVersion=33