@jadamsbit/react-native-mapbox-navigation 1.0.11 → 1.0.13
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/.gitattributes +2 -0
- package/.github/actions/setup/action.yml +27 -0
- package/.github/workflows/ci.yml +154 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +28 -0
- package/.yarn/releases/yarn-3.6.1.cjs +874 -0
- package/CONTRIBUTING.md +117 -6
- package/LICENSE +1 -2
- package/README.md +4 -4
- package/android/build.gradle +9 -5
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/android/gradle.properties +5 -3
- package/android/gradlew +17 -12
- package/android/gradlew.bat +10 -10
- package/android/src/main/AndroidManifest.xml +0 -1
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/jadamsbit/mapboxnavigation/{MapboxNavigationManager.kt → MapboxNavigationModule.kt} +30 -27
- package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationPackage.kt +3 -2
- package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationView.kt +11 -24
- package/android/src/main/res/layout/navigation_view.xml +6 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -7
- package/example/.buckconfig +0 -0
- package/example/{_bundle → .bundle}/config +0 -0
- package/example/.eslintrc.js +1 -1
- package/example/.flowconfig +0 -0
- package/example/.prettierrc.js +2 -2
- package/example/.watchmanconfig +1 -1
- package/example/Gemfile +5 -2
- package/example/NavigationComponent.js +0 -1
- package/example/README.md +79 -0
- package/example/android/app/build.gradle +60 -173
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +0 -0
- package/example/android/app/src/debug/AndroidManifest.xml +1 -5
- package/example/android/app/src/main/AndroidManifest.xml +5 -9
- package/example/android/app/src/main/java/com/mapboxnavigationexample/MainActivity.kt +22 -0
- package/example/android/app/src/main/java/com/mapboxnavigationexample/MainApplication.kt +45 -0
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +1 -1
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +1 -1
- package/example/android/app/src/main/res/values/styles.xml +0 -0
- package/example/android/build.gradle +19 -35
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +3 -1
- package/example/android/gradle.properties +18 -7
- package/example/android/gradlew +173 -109
- package/example/android/gradlew.bat +19 -16
- package/example/android/settings.gradle +3 -3
- package/example/app.json +3 -3
- package/example/babel.config.js +1 -8
- package/example/index.js +3 -7
- package/example/ios/.xcode.env +1 -0
- package/example/ios/.xcode.env.local +2 -0
- package/example/ios/BasicApp/AppDelegate.h +1 -1
- package/example/ios/BasicApp/AppDelegate.m +1 -1
- package/example/ios/BasicApp/Info.plist +18 -18
- package/example/ios/BasicApp.xcodeproj/project.pbxproj +35 -9
- package/example/ios/BasicApp.xcodeproj/xcshareddata/xcschemes/BasicApp.xcscheme +1 -1
- package/example/ios/Podfile +48 -25
- package/example/ios/Podfile.lock +1257 -299
- package/example/jest.config.js +3 -0
- package/example/metro.config.js +19 -19
- package/example/package.json +14 -17
- package/example/react-native.config.js +10 -0
- package/example/{App.js → src/App.js} +3 -3
- package/package.json +1 -1
- package/src/__tests__/index.test.tsx +1 -0
- package/src/typings.ts +0 -1
- package/.vscode/settings.json +0 -3
- package/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
- package/android/.gradle/7.3.3/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.3.3/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.3.3/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.3.3/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.3.3/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/README.md +0 -14
- package/example/Gemfile.lock +0 -100
- package/example/__tests__/App-test.js +0 -14
- package/example/_ruby-version +0 -1
- package/example/android/.gradle/8.2/checksums/checksums.lock +0 -0
- package/example/android/.gradle/8.2/fileChanges/last-build.bin +0 -0
- package/example/android/.gradle/8.2/fileHashes/fileHashes.lock +0 -0
- package/example/android/.gradle/8.2/gc.properties +0 -0
- package/example/android/.gradle/vcs-1/gc.properties +0 -0
- package/example/android/app/_BUCK +0 -55
- package/example/android/app/build_defs.bzl +0 -19
- package/example/android/app/src/debug/java/com/basicapp/ReactNativeFlipper.java +0 -72
- package/example/android/app/src/main/java/com/basicapp/MainActivity.java +0 -15
- package/example/android/app/src/main/java/com/basicapp/MainApplication.java +0 -81
- package/img/bridging-header.png +0 -0
- package/img/build-setting-linking.png +0 -0
- package/img/build-setting-path.png +0 -0
- /package/android/src/main/res/{values → value}/styles.xml +0 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -1,11 +1,122 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Contributions are always welcome, no matter how large or small!
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Development workflow
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
|
|
10
|
+
|
|
11
|
+
- The library package in the root directory.
|
|
12
|
+
- An example app in the `example/` directory.
|
|
13
|
+
|
|
14
|
+
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
yarn
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
|
|
21
|
+
|
|
22
|
+
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
|
|
23
|
+
|
|
24
|
+
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
|
|
25
|
+
|
|
26
|
+
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/MapboxNavigationExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-mapbox-navigation`.
|
|
27
|
+
|
|
28
|
+
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-mapbox-navigation` under `Android`.
|
|
29
|
+
|
|
30
|
+
You can use various commands from the root directory to work with the project.
|
|
31
|
+
|
|
32
|
+
To start the packager:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
yarn example start
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To run the example app on Android:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
yarn example android
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To run the example app on iOS:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
yarn example ios
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Make sure your code passes TypeScript and ESLint. Run the following to verify:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
yarn typecheck
|
|
54
|
+
yarn lint
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To fix formatting errors, run the following:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
yarn lint --fix
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Remember to add tests for your change if possible. Run the unit tests by:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
yarn test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Commit message convention
|
|
70
|
+
|
|
71
|
+
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
|
|
72
|
+
|
|
73
|
+
- `fix`: bug fixes, e.g. fix crash due to deprecated method.
|
|
74
|
+
- `feat`: new features, e.g. add new method to the module.
|
|
75
|
+
- `refactor`: code refactor, e.g. migrate from class components to hooks.
|
|
76
|
+
- `docs`: changes into documentation, e.g. add usage example for the module..
|
|
77
|
+
- `test`: adding or updating tests, e.g. add integration tests using detox.
|
|
78
|
+
- `chore`: tooling changes, e.g. change CI config.
|
|
79
|
+
|
|
80
|
+
Our pre-commit hooks verify that your commit message matches this format when committing.
|
|
81
|
+
|
|
82
|
+
### Linting and tests
|
|
83
|
+
|
|
84
|
+
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
|
|
85
|
+
|
|
86
|
+
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
|
|
87
|
+
|
|
88
|
+
Our pre-commit hooks verify that the linter and tests pass when committing.
|
|
89
|
+
|
|
90
|
+
### Publishing to npm
|
|
91
|
+
|
|
92
|
+
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
|
|
93
|
+
|
|
94
|
+
To publish new versions, run the following:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
yarn release
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Scripts
|
|
101
|
+
|
|
102
|
+
The `package.json` file contains various scripts for common tasks:
|
|
103
|
+
|
|
104
|
+
- `yarn`: setup project by installing dependencies.
|
|
105
|
+
- `yarn typecheck`: type-check files with TypeScript.
|
|
106
|
+
- `yarn lint`: lint files with ESLint.
|
|
107
|
+
- `yarn test`: run unit tests with Jest.
|
|
108
|
+
- `yarn example start`: start the Metro server for the example app.
|
|
109
|
+
- `yarn example android`: run the example app on Android.
|
|
110
|
+
- `yarn example ios`: run the example app on iOS.
|
|
111
|
+
|
|
112
|
+
### Sending a pull request
|
|
113
|
+
|
|
114
|
+
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
|
|
115
|
+
|
|
116
|
+
When you're sending a pull request:
|
|
117
|
+
|
|
118
|
+
- Prefer small pull requests focused on one change.
|
|
119
|
+
- Verify that linters and tests are passing.
|
|
120
|
+
- Review the documentation to make sure it looks good.
|
|
121
|
+
- Follow the pull request template when opening a pull request.
|
|
122
|
+
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
|
package/LICENSE
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2024 Jamie Adams
|
|
4
|
-
|
|
5
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
6
|
in the Software without restriction, including without limitation the rights
|
|
@@ -18,4 +17,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
17
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
18
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
19
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
20
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- <img alt="React Native Mapbox Navigation" src="./img/ios-nav.png?v=2" width="300" align="right" /> -->
|
|
4
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.
|
|
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
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -237,9 +237,9 @@ For more information you can read the [docs provided by Mapbox](https://docs.map
|
|
|
237
237
|
## Usage
|
|
238
238
|
|
|
239
239
|
```jsx
|
|
240
|
-
import * as React from
|
|
241
|
-
import { StyleSheet, View } from
|
|
242
|
-
import MapboxNavigation from
|
|
240
|
+
import * as React from 'react';
|
|
241
|
+
import { StyleSheet, View } from 'react-native';
|
|
242
|
+
import MapboxNavigation from '@jadamsbit/react-native-mapbox-navigation';
|
|
243
243
|
|
|
244
244
|
export const SomeComponent = () => {
|
|
245
245
|
return (
|
package/android/build.gradle
CHANGED
|
@@ -8,7 +8,7 @@ buildscript {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:7.
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.3.1"
|
|
12
12
|
// noinspection DifferentKotlinGradleVersion
|
|
13
13
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
14
|
}
|
|
@@ -55,8 +55,8 @@ android {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
compileOptions {
|
|
58
|
-
sourceCompatibility JavaVersion.
|
|
59
|
-
targetCompatibility JavaVersion.
|
|
58
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
59
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Add the block below if you're using Kotlin
|
|
@@ -66,8 +66,11 @@ android {
|
|
|
66
66
|
|
|
67
67
|
buildFeatures {
|
|
68
68
|
viewBinding true
|
|
69
|
+
buildConfig true
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
namespace 'com.jadamsbit.mapboxnavigation'
|
|
73
|
+
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
repositories {
|
|
@@ -81,13 +84,14 @@ dependencies {
|
|
|
81
84
|
// For < 0.71, this will be from the local maven repo
|
|
82
85
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
83
86
|
//noinspection GradleDynamicVersion
|
|
84
|
-
implementation "com.facebook.react:react-native
|
|
87
|
+
implementation "com.facebook.react:react-native:0.20.1"
|
|
85
88
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
86
89
|
|
|
87
90
|
// mapbox dependencies
|
|
88
91
|
implementation "com.mapbox.navigation:android:2.18.1"
|
|
89
92
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
90
93
|
implementation 'androidx.cardview:cardview:1.0.0'
|
|
94
|
+
implementation 'androidx.core:core:1.12.0'
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if (isNewArchitectureEnabled()) {
|
|
@@ -96,4 +100,4 @@ if (isNewArchitectureEnabled()) {
|
|
|
96
100
|
libraryName = "MapboxNavigationView"
|
|
97
101
|
codegenJavaPackageName = "com.jadamsbit.mapboxnavigation"
|
|
98
102
|
}
|
|
99
|
-
}
|
|
103
|
+
}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#Mon Feb 12 09:11:13 IST 2024
|
|
2
1
|
distributionBase=GRADLE_USER_HOME
|
|
3
2
|
distributionPath=wrapper/dists
|
|
4
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
|
5
4
|
networkTimeout=10000
|
|
5
|
+
validateDistributionUrl=true
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
7
7
|
zipStorePath=wrapper/dists
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
MapboxNavigation_kotlinVersion=1.
|
|
2
|
-
MapboxNavigation_compileSdkVersion=33
|
|
1
|
+
MapboxNavigation_kotlinVersion=1.9.23
|
|
3
2
|
MapboxNavigation_minSdkVersion=21
|
|
4
|
-
MapboxNavigation_targetSdkVersion=
|
|
3
|
+
MapboxNavigation_targetSdkVersion=34
|
|
4
|
+
MapboxNavigation_compileSdkVersion=34
|
|
5
|
+
MapboxNavigation_ndkversion=21.4.7075529
|
|
6
|
+
android.useAndroidX=true
|
package/android/gradlew
CHANGED
|
@@ -83,10 +83,8 @@ done
|
|
|
83
83
|
# This is normally unused
|
|
84
84
|
# shellcheck disable=SC2034
|
|
85
85
|
APP_BASE_NAME=${0##*/}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
89
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
86
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
87
|
+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
|
90
88
|
|
|
91
89
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
90
|
MAX_FD=maximum
|
|
@@ -133,10 +131,13 @@ location of your Java installation."
|
|
|
133
131
|
fi
|
|
134
132
|
else
|
|
135
133
|
JAVACMD=java
|
|
136
|
-
|
|
134
|
+
if ! command -v java >/dev/null 2>&1
|
|
135
|
+
then
|
|
136
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
137
137
|
|
|
138
138
|
Please set the JAVA_HOME variable in your environment to match the
|
|
139
139
|
location of your Java installation."
|
|
140
|
+
fi
|
|
140
141
|
fi
|
|
141
142
|
|
|
142
143
|
# Increase the maximum file descriptors if we can.
|
|
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
|
144
145
|
case $MAX_FD in #(
|
|
145
146
|
max*)
|
|
146
147
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
147
|
-
# shellcheck disable=SC3045
|
|
148
|
+
# shellcheck disable=SC2039,SC3045
|
|
148
149
|
MAX_FD=$( ulimit -H -n ) ||
|
|
149
150
|
warn "Could not query maximum file descriptor limit"
|
|
150
151
|
esac
|
|
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
|
152
153
|
'' | soft) :;; #(
|
|
153
154
|
*)
|
|
154
155
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
155
|
-
# shellcheck disable=SC3045
|
|
156
|
+
# shellcheck disable=SC2039,SC3045
|
|
156
157
|
ulimit -n "$MAX_FD" ||
|
|
157
158
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
158
159
|
esac
|
|
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|
|
197
198
|
done
|
|
198
199
|
fi
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
#
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
#
|
|
201
|
+
|
|
202
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
203
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
204
|
+
|
|
205
|
+
# Collect all arguments for the java command:
|
|
206
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
207
|
+
# and any embedded shellness will be escaped.
|
|
208
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
209
|
+
# treated as '${Hostname}' itself on the command line.
|
|
205
210
|
|
|
206
211
|
set -- \
|
|
207
212
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
package/android/gradlew.bat
CHANGED
|
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
|
|
43
43
|
%JAVA_EXE% -version >NUL 2>&1
|
|
44
44
|
if %ERRORLEVEL% equ 0 goto execute
|
|
45
45
|
|
|
46
|
-
echo.
|
|
47
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
48
|
-
echo.
|
|
49
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
50
|
-
echo location of your Java installation.
|
|
46
|
+
echo. 1>&2
|
|
47
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
50
|
+
echo location of your Java installation. 1>&2
|
|
51
51
|
|
|
52
52
|
goto fail
|
|
53
53
|
|
|
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
|
57
57
|
|
|
58
58
|
if exist "%JAVA_EXE%" goto execute
|
|
59
59
|
|
|
60
|
-
echo.
|
|
61
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
62
|
-
echo.
|
|
63
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
64
|
-
echo location of your Java installation.
|
|
60
|
+
echo. 1>&2
|
|
61
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
64
|
+
echo location of your Java installation. 1>&2
|
|
65
65
|
|
|
66
66
|
goto fail
|
|
67
67
|
|
|
@@ -12,12 +12,17 @@ import com.mapbox.maps.ResourceOptionsManager
|
|
|
12
12
|
import com.mapbox.maps.TileStoreUsageMode
|
|
13
13
|
import javax.annotation.Nonnull
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class MapboxNavigationModule(var mCallerContext: ReactApplicationContext) : SimpleViewManager<MapboxNavigationView>() {
|
|
16
16
|
private var accessToken: String? = null
|
|
17
|
+
|
|
17
18
|
init {
|
|
18
19
|
mCallerContext.runOnUiQueueThread {
|
|
19
20
|
try {
|
|
20
|
-
val app =
|
|
21
|
+
val app =
|
|
22
|
+
mCallerContext.packageManager.getApplicationInfo(
|
|
23
|
+
mCallerContext.packageName,
|
|
24
|
+
PackageManager.GET_META_DATA
|
|
25
|
+
)
|
|
21
26
|
val bundle = app.metaData
|
|
22
27
|
val accessToken = bundle.getString("MAPBOX_ACCESS_TOKEN")
|
|
23
28
|
this.accessToken = accessToken
|
|
@@ -29,9 +34,19 @@ class MapboxNavigationManager(var mCallerContext: ReactApplicationContext) : Sim
|
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
|
-
override fun getName(): String = "MapboxNavigation"
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
|
|
39
|
+
override fun getName(): String {
|
|
40
|
+
return NAME
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
companion object {
|
|
44
|
+
const val NAME = "MapboxNavigation"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public override fun createViewInstance(
|
|
48
|
+
@Nonnull reactContext: ThemedReactContext
|
|
49
|
+
): MapboxNavigationView {
|
|
35
50
|
return MapboxNavigationView(reactContext, this.accessToken)
|
|
36
51
|
}
|
|
37
52
|
|
|
@@ -42,11 +57,16 @@ class MapboxNavigationManager(var mCallerContext: ReactApplicationContext) : Sim
|
|
|
42
57
|
|
|
43
58
|
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Map<String, String>>? {
|
|
44
59
|
return MapBuilder.of<String, Map<String, String>>(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
"onLocationChange",
|
|
61
|
+
MapBuilder.of("registrationName", "onLocationChange"),
|
|
62
|
+
"onError",
|
|
63
|
+
MapBuilder.of("registrationName", "onError"),
|
|
64
|
+
"onCancelNavigation",
|
|
65
|
+
MapBuilder.of("registrationName", "onCancelNavigation"),
|
|
66
|
+
"onArrive",
|
|
67
|
+
MapBuilder.of("registrationName", "onArrive"),
|
|
68
|
+
"onRouteProgressChange",
|
|
69
|
+
MapBuilder.of("registrationName", "onRouteProgressChange"),
|
|
50
70
|
)
|
|
51
71
|
}
|
|
52
72
|
|
|
@@ -82,21 +102,4 @@ class MapboxNavigationManager(var mCallerContext: ReactApplicationContext) : Sim
|
|
|
82
102
|
fun setMute(view: MapboxNavigationView, mute: Boolean) {
|
|
83
103
|
view.setMute(mute)
|
|
84
104
|
}
|
|
85
|
-
|
|
86
|
-
@ReactProp(name = "waypoints")
|
|
87
|
-
fun setWaypoints(view: MapboxNavigationView, waypointsArray: ReadableArray?) {
|
|
88
|
-
waypointsArray?.let {
|
|
89
|
-
val waypoints = mutableListOf<Point>()
|
|
90
|
-
for (i in 0 until it.size()) {
|
|
91
|
-
val waypointArray = it.getArray(i)
|
|
92
|
-
if (waypointArray !== null && waypointArray.size() >= 2) {
|
|
93
|
-
val longitude = waypointArray.getDouble(0)
|
|
94
|
-
val latitude = waypointArray.getDouble(1)
|
|
95
|
-
waypoints.add(Point.fromLngLat(longitude, latitude))
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
view.setWaypoints(waypoints)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
105
|
+
}
|
|
@@ -4,6 +4,7 @@ import com.facebook.react.ReactPackage
|
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
import java.util.*
|
|
7
8
|
|
|
8
9
|
class MapboxNavigationPackage : ReactPackage {
|
|
9
10
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
@@ -11,6 +12,6 @@ class MapboxNavigationPackage : ReactPackage {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
14
|
-
return
|
|
15
|
+
return Arrays.asList<ViewManager<*, *>>(MapboxNavigationModule(reactContext))
|
|
15
16
|
}
|
|
16
|
-
}
|
|
17
|
+
}
|
|
@@ -87,7 +87,6 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
private var origin: Point? = null
|
|
90
|
-
private var waypoints: List<Point>? = null
|
|
91
90
|
private var destination: Point? = null
|
|
92
91
|
private var shouldSimulateRoute = false
|
|
93
92
|
private var showsEndOfRouteFeedback = false
|
|
@@ -471,6 +470,7 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
471
470
|
bearingImage = ContextCompat.getDrawable(
|
|
472
471
|
context,
|
|
473
472
|
com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon
|
|
473
|
+
|
|
474
474
|
)
|
|
475
475
|
)
|
|
476
476
|
setLocationProvider(navigationLocationProvider)
|
|
@@ -628,13 +628,7 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
628
628
|
mapboxNavigation.registerVoiceInstructionsObserver(voiceInstructionsObserver)
|
|
629
629
|
mapboxNavigation.registerRouteProgressObserver(replayProgressObserver)
|
|
630
630
|
|
|
631
|
-
|
|
632
|
-
val coordinatesList = mutableListOf<Point>()
|
|
633
|
-
this.origin?.let { coordinatesList.add(it) }
|
|
634
|
-
this.waypoints?.let { coordinatesList.addAll(it) }
|
|
635
|
-
this.destination?.let { coordinatesList.add(it) }
|
|
636
|
-
|
|
637
|
-
findRoute(coordinatesList)
|
|
631
|
+
this.origin?.let { this.destination?.let { it1 -> this.findRoute(it, it1) } }
|
|
638
632
|
}
|
|
639
633
|
|
|
640
634
|
override fun onDetachedFromWindow() {
|
|
@@ -656,19 +650,16 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
656
650
|
voiceInstructionsPlayer.shutdown()
|
|
657
651
|
}
|
|
658
652
|
|
|
659
|
-
private fun findRoute(
|
|
653
|
+
private fun findRoute(origin: Point, destination: Point) {
|
|
660
654
|
try {
|
|
661
|
-
val routeOptionsBuilder = RouteOptions.builder()
|
|
662
|
-
.applyDefaultNavigationOptions()
|
|
663
|
-
.applyLanguageAndVoiceUnitOptions(context)
|
|
664
|
-
.coordinatesList(coordinates)
|
|
665
|
-
.profile(DirectionsCriteria.PROFILE_DRIVING)
|
|
666
|
-
.steps(true)
|
|
667
|
-
|
|
668
|
-
val routeOptions = routeOptionsBuilder.build()
|
|
669
|
-
|
|
670
655
|
mapboxNavigation.requestRoutes(
|
|
671
|
-
|
|
656
|
+
RouteOptions.builder()
|
|
657
|
+
.applyDefaultNavigationOptions()
|
|
658
|
+
.applyLanguageAndVoiceUnitOptions(context)
|
|
659
|
+
.coordinatesList(listOf(origin, destination))
|
|
660
|
+
.profile(DirectionsCriteria.PROFILE_DRIVING)
|
|
661
|
+
.steps(true)
|
|
662
|
+
.build(),
|
|
672
663
|
object : RouterCallback {
|
|
673
664
|
override fun onRoutesReady(
|
|
674
665
|
routes: List<DirectionsRoute>,
|
|
@@ -759,10 +750,6 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
759
750
|
this.origin = origin
|
|
760
751
|
}
|
|
761
752
|
|
|
762
|
-
fun setWaypoints(waypoints: List<Point>) {
|
|
763
|
-
this.waypoints = waypoints
|
|
764
|
-
}
|
|
765
|
-
|
|
766
753
|
fun setDestination(destination: Point?) {
|
|
767
754
|
this.destination = destination
|
|
768
755
|
}
|
|
@@ -778,4 +765,4 @@ class MapboxNavigationView(private val context: ThemedReactContext, private val
|
|
|
778
765
|
fun setMute(mute: Boolean) {
|
|
779
766
|
this.isVoiceInstructionsMuted = mute
|
|
780
767
|
}
|
|
781
|
-
}
|
|
768
|
+
}
|
|
@@ -26,20 +26,19 @@
|
|
|
26
26
|
|
|
27
27
|
<com.mapbox.navigation.ui.tripprogress.view.MapboxTripProgressView
|
|
28
28
|
android:id="@+id/tripProgressView"
|
|
29
|
-
android:layout_width="
|
|
29
|
+
android:layout_width="match_parent"
|
|
30
30
|
android:layout_height="wrap_content"
|
|
31
|
-
android:layout_gravity="
|
|
32
|
-
|
|
33
|
-
android:layout_marginTop="8dp" />
|
|
31
|
+
android:layout_gravity="left"
|
|
32
|
+
/>
|
|
34
33
|
|
|
35
34
|
<ImageView
|
|
36
35
|
android:id="@+id/stop"
|
|
37
36
|
android:layout_width="48dp"
|
|
38
37
|
android:layout_height="48dp"
|
|
39
|
-
android:layout_gravity="
|
|
38
|
+
android:layout_gravity="end|center_vertical"
|
|
40
39
|
android:layout_marginEnd="12dp"
|
|
41
|
-
app:
|
|
42
|
-
app:
|
|
40
|
+
app:tint="@android:color/darker_gray"
|
|
41
|
+
app:srcCompat="@android:drawable/ic_delete" />
|
|
43
42
|
</androidx.cardview.widget.CardView>
|
|
44
43
|
|
|
45
44
|
<com.mapbox.navigation.ui.maneuver.view.MapboxManeuverView
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { requireNativeComponent, StyleSheet } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { requireNativeComponent, StyleSheet } from "react-native";
|
|
3
3
|
const MapboxNavigation = (props) => {
|
|
4
|
-
|
|
4
|
+
return <RNMapboxNavigation style={styles.container} {...props} />;
|
|
5
5
|
};
|
|
6
|
-
const RNMapboxNavigation = requireNativeComponent(
|
|
6
|
+
const RNMapboxNavigation = requireNativeComponent(
|
|
7
|
+
"MapboxNavigation",
|
|
8
|
+
MapboxNavigation
|
|
9
|
+
);
|
|
7
10
|
const styles = StyleSheet.create({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
container: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
},
|
|
11
14
|
});
|
|
12
15
|
export default MapboxNavigation;
|
package/example/.buckconfig
CHANGED
|
File without changes
|
|
File without changes
|
package/example/.eslintrc.js
CHANGED
package/example/.flowconfig
CHANGED
|
File without changes
|
package/example/.prettierrc.js
CHANGED
package/example/.watchmanconfig
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{}
|
|
1
|
+
{}
|
package/example/Gemfile
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
-
ruby
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
|
|
7
|
+
# bound in the template on Cocoapods with next React Native release.
|
|
8
|
+
gem 'cocoapods', '>= 1.13', '< 1.15'
|
|
9
|
+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|