Skip to content

Commit b9f046f

Browse files
committed
fix: update to nitro v0.35.1
1 parent 8478bc4 commit b9f046f

8 files changed

Lines changed: 661 additions & 596 deletions

File tree

android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ class RNGoogleMapsPlusView(
4141
override val view =
4242
GoogleMapsViewImpl(context, locationHandler, playServiceHandler, markerBuilder, mapErrorHandler)
4343

44-
override fun dispose() {
44+
override fun onDropView() {
4545
view.destroyInternal()
46-
super.dispose()
4746
}
4847

4948
override var initialProps: RNInitialProps? = null

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PODS:
3535
- hermes-engine (250829098.0.9):
3636
- hermes-engine/Pre-built (= 250829098.0.9)
3737
- hermes-engine/Pre-built (250829098.0.9)
38-
- NitroModules (0.35.0):
38+
- NitroModules (0.35.1):
3939
- hermes-engine
4040
- RCTRequired
4141
- RCTTypeSafety
@@ -2418,7 +2418,7 @@ SPEC CHECKSUMS:
24182418
Google-Maps-iOS-Utils: cbaa0660586302c8d4149b43910a4973494ed64c
24192419
GoogleMaps: 133ba5beb4979592001a6cd0125a502243439ff9
24202420
hermes-engine: 0f49a842b975f3720533f9a7d353cd9e0f578f75
2421-
NitroModules: b7fbb99c94da87b162f6e661d7cfa8ad014f7b7d
2421+
NitroModules: 3ccfac829344db72859f6ec0d07f58cfe39f4cd1
24222422
RCTDeprecation: af44b104091a34482596cd9bd7e8d90c4e9b4bd7
24232423
RCTRequired: bb77b070f75f53398ce43c0aaaa58337cebe2bf6
24242424
RCTSwiftUI: afc0a0a635860da1040a0b894bfd529da06d7810

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
},
1313
"dependencies": {
1414
"@react-navigation/native": "7.1.33",
15-
"@react-navigation/native-stack": "7.14.4",
16-
"@react-navigation/stack": "7.8.4",
15+
"@react-navigation/native-stack": "7.14.5",
16+
"@react-navigation/stack": "7.8.5",
1717
"react": "19.2.3",
1818
"react-hook-form": "7.71.2",
1919
"react-native": "0.84.1",
2020
"react-native-clusterer": "5.0.2",
2121
"react-native-gesture-handler": "2.30.0",
2222
"react-native-google-maps-plus": "workspace:*",
23-
"react-native-nitro-modules": "0.35.0",
23+
"react-native-nitro-modules": "0.35.1",
2424
"react-native-reanimated": "4.2.2",
2525
"react-native-safe-area-context": "5.7.0",
2626
"react-native-screens": "4.24.0",

ios/RNGoogleMapsPlusView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
3434
)
3535
}
3636

37-
func dispose() {
37+
func onDropView() {
3838
impl.deinitInternal()
3939
}
4040

nitro.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@
1616
],
1717
"autolinking": {
1818
"RNGoogleMapsPlusView": {
19-
"swift": "RNGoogleMapsPlusView",
20-
"kotlin": "RNGoogleMapsPlusView"
19+
"ios": {
20+
"language": "swift",
21+
"implementationClassName": "RNGoogleMapsPlusView"
22+
},
23+
"android": {
24+
"language": "kotlin",
25+
"implementationClassName": "RNGoogleMapsPlusView"
26+
}
2127
},
2228
"RNGoogleMapsPlusModule": {
23-
"swift": "RNGoogleMapsPlusModule",
24-
"kotlin": "RNGoogleMapsPlusModule"
29+
"ios": {
30+
"language": "swift",
31+
"implementationClassName": "RNGoogleMapsPlusModule"
32+
},
33+
"android": {
34+
"language": "kotlin",
35+
"implementationClassName": "RNGoogleMapsPlusModule"
36+
}
2537
}
2638
},
2739
"ignorePaths": ["**/node_modules"]

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
"provenance": true
7878
},
7979
"devDependencies": {
80-
"@commitlint/cli": "20.4.3",
81-
"@commitlint/config-conventional": "20.4.3",
82-
"@eslint/compat": "2.0.2",
83-
"@eslint/eslintrc": "3.3.4",
84-
"@eslint/js": "9.39.3",
80+
"@commitlint/cli": "20.4.4",
81+
"@commitlint/config-conventional": "20.4.4",
82+
"@eslint/compat": "2.0.3",
83+
"@eslint/eslintrc": "3.3.5",
84+
"@eslint/js": "9.39.4",
8585
"@expo/config-plugins": "55.0.6",
8686
"@react-native/babel-preset": "0.84.1",
8787
"@react-native/eslint-config": "0.84.1",
@@ -93,22 +93,22 @@
9393
"@types/react": "19.2.14",
9494
"conventional-changelog-conventionalcommits": "9.3.0",
9595
"del-cli": "7.0.0",
96-
"eslint": "9.39.3",
96+
"eslint": "9.39.4",
9797
"eslint-config-prettier": "10.1.8",
9898
"eslint-import-resolver-typescript": "4.4.4",
9999
"eslint-plugin-import": "2.32.0",
100-
"eslint-plugin-jsdoc": "62.7.1",
100+
"eslint-plugin-jsdoc": "62.8.0",
101101
"eslint-plugin-prettier": "5.5.5",
102102
"eslint-plugin-tsdoc": "0.5.2",
103103
"eslint-plugin-unused-imports": "4.4.1",
104-
"jest": "30.2.0",
105-
"lefthook": "2.1.2",
106-
"nitrogen": "0.35.0",
104+
"jest": "30.3.0",
105+
"lefthook": "2.1.4",
106+
"nitrogen": "0.35.1",
107107
"prettier": "3.8.1",
108108
"react": "19.2.3",
109109
"react-native": "0.84.1",
110110
"react-native-builder-bob": "0.40.18",
111-
"react-native-nitro-modules": "0.35.0",
111+
"react-native-nitro-modules": "0.35.1",
112112
"semantic-release": "25.0.3",
113113
"typedoc": "0.28.17",
114114
"typescript": "5.9.3"

scripts/nitrogen-patch.js

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,27 @@
55
* - Replaces 'com.margelo.nitro.rngooglemapsplus' -> 'com.rngooglemapsplus'
66
* - Replaces 'com/margelo/nitro/rngooglemapsplus' -> 'com/rngooglemapsplus'
77
* - Removes 'margelo/nitro/' in RNGoogleMapsPlusOnLoad.cpp
8-
* - Inserts `onDropViewInstance()`
9-
* nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt
10-
*
118
* iOS
12-
* - Inserts `+ (void)dealloc`
13-
* nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm
149
*/
1510
import { readFile, readdir, writeFile } from 'node:fs/promises';
1611
import { copyFile, mkdir } from 'node:fs/promises';
1712
import path from 'node:path';
18-
import { basename } from 'path';
19-
import { fileURLToPath } from 'url';
2013

2114
const ROOT_ANDROID = path.join(
2215
process.cwd(),
2316
'nitrogen',
2417
'generated',
2518
'android'
2619
);
27-
const ROOT_IOS = path.join(process.cwd(), 'nitrogen', 'generated', 'ios');
20+
2821
const SRC_JSON_DIR = path.join(
2922
process.cwd(),
3023
'nitrogen',
3124
'generated',
3225
'shared',
3326
'json'
3427
);
28+
3529
const DEST_JSON_DIR = path.join(
3630
process.cwd(),
3731
'lib',
@@ -46,16 +40,6 @@ const ANDROID_ONLOAD_FILE = path.join(
4640
'RNGoogleMapsPlusOnLoad.cpp'
4741
);
4842

49-
const HYBRID_VIEW_MANAGER = path.join(
50-
ROOT_ANDROID,
51-
'kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt'
52-
);
53-
54-
const HYBRID_VIEW_COMPONENT_IOS = path.join(
55-
ROOT_IOS,
56-
'c++/views/HybridRNGoogleMapsPlusViewComponent.mm'
57-
);
58-
5943
const REPLACEMENTS = [
6044
{
6145
regex: /com\.margelo\.nitro\.rngooglemapsplus/g,
@@ -67,30 +51,6 @@ const REPLACEMENTS = [
6751
},
6852
];
6953

70-
const __filename = fileURLToPath(import.meta.url);
71-
const filename = basename(__filename);
72-
73-
const PATCH_MARKER = ` // added by ${filename}`;
74-
75-
const ON_DROP_VIEW_INSTANCE_ANDROID = `
76-
${PATCH_MARKER}
77-
override fun onDropViewInstance(view: View) {
78-
val hybridView = view.getTag(associated_hybrid_view_tag) as? RNGoogleMapsPlusView
79-
hybridView?.dispose()
80-
view.setTag(associated_hybrid_view_tag, null)
81-
super.onDropViewInstance(view)
82-
}`;
83-
84-
const DEALLOC_METHOD_IOS = `
85-
${PATCH_MARKER}
86-
- (void)dealloc {
87-
if (_hybridView) {
88-
RNGoogleMapsPlus::HybridRNGoogleMapsPlusViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
89-
swiftPart.dispose();
90-
_hybridView.reset();
91-
}
92-
}`;
93-
9454
async function processFile(filePath) {
9555
let content = await readFile(filePath, 'utf8');
9656
let updated = content;
@@ -103,36 +63,6 @@ async function processFile(filePath) {
10363
updated = updated.replace(/margelo\/nitro\//g, '');
10464
}
10565

106-
if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_MANAGER)) {
107-
if (!updated.includes(PATCH_MARKER)) {
108-
const pattern = /(override\s+fun\s+createViewInstance[\s\S]*?\})/m;
109-
110-
if (!pattern.test(updated)) {
111-
throw new Error(
112-
`Pattern for "createViewInstance" not found in ${filePath}`
113-
);
114-
}
115-
116-
updated = updated.replace(
117-
pattern,
118-
`$1\n${ON_DROP_VIEW_INSTANCE_ANDROID}`
119-
);
120-
}
121-
}
122-
123-
if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_COMPONENT_IOS)) {
124-
if (!updated.includes(PATCH_MARKER)) {
125-
const initPattern =
126-
/(-\s*\(instancetype\)\s*init[\s\S]*?return\s+self;\s*\})/m;
127-
128-
if (!initPattern.test(updated)) {
129-
throw new Error(`Pattern for "init" not found in ${filePath}`);
130-
}
131-
132-
updated = updated.replace(initPattern, `$1\n${DEALLOC_METHOD_IOS}`);
133-
}
134-
}
135-
13666
if (updated !== content) {
13767
await writeFile(filePath, updated, 'utf8');
13868
console.log(`Updated: ${filePath}`);
@@ -172,7 +102,6 @@ async function copyJsonFiles() {
172102
try {
173103
await copyJsonFiles();
174104
await start(ROOT_ANDROID);
175-
await start(ROOT_IOS);
176105
console.log('All Nitrogen files patched successfully.');
177106
} catch (err) {
178107
console.error('Error while processing files:', err);

0 commit comments

Comments
 (0)