Skip to content

Commit 2b69764

Browse files
authored
feat: support latest rn versions (#467)
1 parent 4f09ae1 commit 2b69764

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4011
-6536
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ jobs:
173173
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
174174
175175
build-ios:
176-
runs-on: macos-14
176+
runs-on:
177+
labels: macos-latest-xlarge
177178
timeout-minutes: 45
178179
env:
179180
TURBO_CACHE_DIR: .turbo/ios

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Keys.plist
3939
.idea
4040
.project
4141
.settings
42+
.kotlin
4243
local.properties
4344
android.iml
4445

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
v22

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 18.20.1
1+
nodejs 22.14.0

.yarn/releases/yarn-3.6.1.cjs renamed to .yarn/releases/yarn-3.6.4.cjs

Lines changed: 213 additions & 213 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
nodeLinker: node-modules
1615
nmHoistingLimits: workspaces
1716

17+
nodeLinker: node-modules
18+
1819
plugins:
1920
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
20-
spec: "@yarnpkg/plugin-interactive-tools"
21+
spec: '@yarnpkg/plugin-interactive-tools'
2122
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
22-
spec: "@yarnpkg/plugin-workspace-tools"
23+
spec: '@yarnpkg/plugin-workspace-tools'
2324

24-
yarnPath: .yarn/releases/yarn-3.6.1.cjs
25+
yarnPath: .yarn/releases/yarn-3.6.4.cjs

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This repository contains a React Native plugin that provides a [Google Navigatio
1515

1616
| | Android | iOS |
1717
| ------------------------------- | ------- | --------- |
18-
| **Minimum mobile OS supported** | SDK 23+ | iOS 16.0+ |
18+
| **Minimum mobile OS supported** | SDK 24+ | iOS 16.0+ |
1919

2020
* A React Native project
2121
* A Google Cloud project
@@ -84,12 +84,12 @@ dependencies {
8484

8585
#### Minimum SDK Requirements for Android
8686

87-
The `minSdkVersion` for your Android project must be set to 23 or higher in `android/app/build.gradle`:
87+
The `minSdkVersion` for your Android project must be set to 24 or higher in `android/app/build.gradle`:
8888

8989
```groovy
9090
android {
9191
defaultConfig {
92-
minSdkVersion 23
92+
minSdkVersion 24
9393
}
9494
}
9595
```

android/build.gradle

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// http://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,16 +15,16 @@
1515
import groovy.json.JsonSlurper
1616

1717
buildscript {
18-
ext.kotlin_version = '2.1.21'
19-
repositories {
20-
google()
21-
mavenCentral()
22-
}
18+
ext.kotlin_version = '2.1.21'
19+
repositories {
20+
google()
21+
mavenCentral()
22+
}
2323

24-
dependencies {
25-
classpath("com.android.tools.build:gradle:8.4.0")
26-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
27-
}
24+
dependencies {
25+
classpath "com.android.tools.build:gradle:8.7.2"
26+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
27+
}
2828
}
2929

3030
def isNewArchitectureEnabled() {
@@ -38,44 +38,50 @@ if (isNewArchitectureEnabled()) {
3838
}
3939

4040
android {
41-
namespace "com.google.android.react.navsdk"
42-
compileSdkVersion 35
41+
namespace "com.google.android.react.navsdk"
42+
compileSdkVersion 35
4343

44-
compileOptions {
45-
sourceCompatibility JavaVersion.VERSION_1_8
46-
targetCompatibility JavaVersion.VERSION_1_8
47-
}
44+
compileOptions {
45+
sourceCompatibility JavaVersion.VERSION_1_8
46+
targetCompatibility JavaVersion.VERSION_1_8
47+
}
4848

49-
defaultConfig {
50-
minSdkVersion 24
51-
targetSdkVersion 34
52-
versionCode 1
53-
// get version name from package.json version
54-
versionName "1.0"
55-
}
49+
defaultConfig {
50+
minSdkVersion 24
51+
targetSdkVersion 34
52+
}
5653

57-
buildTypes {
58-
release {
59-
minifyEnabled true
60-
}
61-
}
54+
buildFeatures {
55+
buildConfig true
56+
}
6257

63-
lintOptions {
64-
abortOnError false
65-
disable "GradleCompatible"
58+
buildTypes {
59+
release {
60+
minifyEnabled true
6661
}
62+
}
63+
64+
lintOptions {
65+
abortOnError false
66+
disable "GradleCompatible"
67+
}
68+
69+
compileOptions {
70+
sourceCompatibility JavaVersion.VERSION_1_8
71+
targetCompatibility JavaVersion.VERSION_1_8
72+
}
6773
}
6874

6975
repositories {
70-
google()
71-
mavenCentral()
76+
google()
77+
mavenCentral()
7278
}
7379

7480
dependencies {
75-
implementation "androidx.car.app:app:1.4.0"
76-
implementation "androidx.car.app:app-projected:1.4.0"
77-
implementation 'com.facebook.react:react-native:+'
78-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
79-
implementation "com.google.android.libraries.navigation:navigation:6.3.1"
80-
api 'com.google.guava:guava:31.0.1-android'
81+
implementation 'com.facebook.react:react-native:+'
82+
implementation "androidx.car.app:app:1.4.0"
83+
implementation "androidx.car.app:app-projected:1.4.0"
84+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
85+
implementation "com.google.android.libraries.navigation:navigation:6.3.1"
86+
api 'com.google.guava:guava:31.0.1-android'
8187
}

android/src/main/java/com/google/android/react/navsdk/Constants.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
package com.google.android.react.navsdk;
1515

1616
public class Constants {
17-
public static final String NAV_JAVASCRIPT_FLAG = "NavJavascriptBridge";
18-
public static final String NAV_AUTO_JAVASCRIPT_FLAG = "NavAutoJavascriptBridge";
1917
public static final String LAT_FIELD_KEY = "lat";
2018
public static final String LNG_FIELD_KEY = "lng";
2119
}

android/src/main/java/com/google/android/react/navsdk/MapViewController.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,10 @@ public GroundOverlay addGroundOverlay(Map<String, Object> map) {
284284
Double lng = null;
285285
if (map.containsKey("location")) {
286286
Map<String, Object> latlng = (Map<String, Object>) map.get("location");
287-
if (latlng.get("lat") != null) lat = Double.parseDouble(latlng.get("lat").toString());
288-
if (latlng.get("lng") != null) lng = Double.parseDouble(latlng.get("lng").toString());
287+
if (latlng.get(Constants.LAT_FIELD_KEY) != null)
288+
lat = Double.parseDouble(latlng.get(Constants.LAT_FIELD_KEY).toString());
289+
if (latlng.get(Constants.LNG_FIELD_KEY) != null)
290+
lng = Double.parseDouble(latlng.get(Constants.LNG_FIELD_KEY).toString());
289291
}
290292

291293
GroundOverlayOptions options = new GroundOverlayOptions();
@@ -568,9 +570,11 @@ private String fetchJsonFromUrl(String urlString) throws IOException {
568570
private LatLng createLatLng(Map<String, Object> map) {
569571
Double lat = null;
570572
Double lng = null;
571-
if (map.containsKey("lat") && map.containsKey("lng")) {
572-
if (map.get("lat") != null) lat = Double.parseDouble(map.get("lat").toString());
573-
if (map.get("lng") != null) lng = Double.parseDouble(map.get("lng").toString());
573+
if (map.containsKey(Constants.LAT_FIELD_KEY) && map.containsKey(Constants.LNG_FIELD_KEY)) {
574+
if (map.get(Constants.LAT_FIELD_KEY) != null)
575+
lat = Double.parseDouble(map.get(Constants.LAT_FIELD_KEY).toString());
576+
if (map.get(Constants.LNG_FIELD_KEY) != null)
577+
lng = Double.parseDouble(map.get(Constants.LNG_FIELD_KEY).toString());
574578
}
575579

576580
return new LatLng(lat, lng);

0 commit comments

Comments
 (0)