Skip to content

Commit 0535c6f

Browse files
authored
chore: update nitro modules
2 parents 2436bc3 + 4cc84ae commit 0535c6f

6 files changed

Lines changed: 360 additions & 462 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ class RNGoogleMapsPlusView(
4141
override val view =
4242
GoogleMapsViewImpl(context, locationHandler, playServiceHandler, markerBuilder, mapErrorHandler)
4343

44+
override fun dispose() {
45+
view.destroyInternal()
46+
super.dispose()
47+
}
48+
4449
override var initialProps: RNInitialProps? = null
4550
set(value) {
4651
if (field == value) return

example/ios/Podfile.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ PODS:
4040
- glog (0.3.5)
4141
- Google-Maps-iOS-Utils (7.0.0):
4242
- GoogleMaps (~> 10.0)
43-
- GoogleMaps (10.7.0):
44-
- GoogleMaps/Maps (= 10.7.0)
45-
- GoogleMaps/Maps (10.7.0)
43+
- GoogleMaps (10.8.0):
44+
- GoogleMaps/Maps (= 10.8.0)
45+
- GoogleMaps/Maps (10.8.0)
4646
- hermes-engine (0.14.0):
4747
- hermes-engine/Pre-built (= 0.14.0)
4848
- hermes-engine/Pre-built (0.14.0)
49-
- NitroModules (0.32.0):
49+
- NitroModules (0.33.8):
5050
- boost
5151
- DoubleConversion
5252
- fast_float
@@ -2632,14 +2632,14 @@ PODS:
26322632
- ReactCommon/turbomodule/core
26332633
- SocketRocket
26342634
- Yoga
2635-
- RNGoogleMapsPlus (1.10.2):
2635+
- RNGoogleMapsPlus (1.11.0):
26362636
- boost
26372637
- DoubleConversion
26382638
- fast_float
26392639
- fmt
26402640
- glog
26412641
- Google-Maps-iOS-Utils (= 7.0.0)
2642-
- GoogleMaps (= 10.7.0)
2642+
- GoogleMaps (= 10.8.0)
26432643
- hermes-engine
26442644
- NitroModules
26452645
- RCT-Folly
@@ -2757,7 +2757,7 @@ PODS:
27572757
- RNWorklets
27582758
- SocketRocket
27592759
- Yoga
2760-
- RNScreens (4.19.0):
2760+
- RNScreens (4.23.0):
27612761
- boost
27622762
- DoubleConversion
27632763
- fast_float
@@ -2784,10 +2784,10 @@ PODS:
27842784
- ReactCodegen
27852785
- ReactCommon/turbomodule/bridging
27862786
- ReactCommon/turbomodule/core
2787-
- RNScreens/common (= 4.19.0)
2787+
- RNScreens/common (= 4.23.0)
27882788
- SocketRocket
27892789
- Yoga
2790-
- RNScreens/common (4.19.0):
2790+
- RNScreens/common (4.23.0):
27912791
- boost
27922792
- DoubleConversion
27932793
- fast_float
@@ -2816,7 +2816,7 @@ PODS:
28162816
- ReactCommon/turbomodule/core
28172817
- SocketRocket
28182818
- Yoga
2819-
- RNWorklets (0.7.1):
2819+
- RNWorklets (0.7.3):
28202820
- boost
28212821
- DoubleConversion
28222822
- fast_float
@@ -2843,10 +2843,10 @@ PODS:
28432843
- ReactCodegen
28442844
- ReactCommon/turbomodule/bridging
28452845
- ReactCommon/turbomodule/core
2846-
- RNWorklets/worklets (= 0.7.1)
2846+
- RNWorklets/worklets (= 0.7.3)
28472847
- SocketRocket
28482848
- Yoga
2849-
- RNWorklets/worklets (0.7.1):
2849+
- RNWorklets/worklets (0.7.3):
28502850
- boost
28512851
- DoubleConversion
28522852
- fast_float
@@ -2873,10 +2873,10 @@ PODS:
28732873
- ReactCodegen
28742874
- ReactCommon/turbomodule/bridging
28752875
- ReactCommon/turbomodule/core
2876-
- RNWorklets/worklets/apple (= 0.7.1)
2876+
- RNWorklets/worklets/apple (= 0.7.3)
28772877
- SocketRocket
28782878
- Yoga
2879-
- RNWorklets/worklets/apple (0.7.1):
2879+
- RNWorklets/worklets/apple (0.7.3):
28802880
- boost
28812881
- DoubleConversion
28822882
- fast_float
@@ -3190,9 +3190,9 @@ SPEC CHECKSUMS:
31903190
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
31913191
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
31923192
Google-Maps-iOS-Utils: cbaa0660586302c8d4149b43910a4973494ed64c
3193-
GoogleMaps: 5db81729b4f6defd40820d46b49a350273ec1d28
3193+
GoogleMaps: fe4035acb768ed14ce732811363f232550ba55af
31943194
hermes-engine: ff3a9fe253825c0e37c52df65dd0c483ded41ece
3195-
NitroModules: 5ab248c0c4bc0a440414c0a8509dbad55cc7da6c
3195+
NitroModules: ceb81cc842944a13b5f7d451f92008e8cf38e12c
31963196
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
31973197
RCTDeprecation: a41bbdd9af30bf2e5715796b313e44ec43eefff1
31983198
RCTRequired: 7be34aabb0b77c3cefe644528df0fa0afad4e4d0
@@ -3264,10 +3264,10 @@ SPEC CHECKSUMS:
32643264
ReactCodegen: d663254bf59e57e5ed7c65638bd45f358a373bba
32653265
ReactCommon: 15e1e727fa34f760beb7dd52928687fda8edf8dc
32663266
RNGestureHandler: c6327cf6e2bd384dc90351ccfff0da8142d62f54
3267-
RNGoogleMapsPlus: b871e689be34a1a2ae40178bc1a4e67dcf54cd6f
3267+
RNGoogleMapsPlus: 66b395c9122ca8c818b82861ad7dd892f83640f8
32683268
RNReanimated: fbcb7fd8da5b0b088401542c58fb5d266388f1cf
3269-
RNScreens: d6413aeb1878cdafd3c721e2c5218faf5d5d3b13
3270-
RNWorklets: 69f7239afaf3a156f7f9549eeb0ae8d02adc095f
3269+
RNScreens: 199799bdab32fa1e17ebf938b06fec52033e81e5
3270+
RNWorklets: 944dddd0eef13006b658e653abbb3ee8365c3809
32713271
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
32723272
SVGKit: 1ad7513f8c74d9652f94ed64ddecda1a23864dea
32733273
Yoga: 33b53536a0500d039f2cd78caf1d5d68712d3af7

example/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,36 @@
1111
"build:ios": "react-native build-ios --mode Debug --extra-params 'CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO'"
1212
},
1313
"dependencies": {
14-
"@react-navigation/native": "7.1.26",
15-
"@react-navigation/native-stack": "7.9.0",
16-
"@react-navigation/stack": "7.6.13",
14+
"@react-navigation/native": "7.1.28",
15+
"@react-navigation/native-stack": "7.12.0",
16+
"@react-navigation/stack": "7.7.1",
1717
"react": "19.2.3",
18-
"react-hook-form": "7.71.0",
18+
"react-hook-form": "7.71.1",
1919
"react-native": "0.83.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.32.0",
23+
"react-native-nitro-modules": "0.33.8",
2424
"react-native-reanimated": "4.2.1",
2525
"react-native-safe-area-context": "5.6.2",
26-
"react-native-screens": "4.19.0",
27-
"react-native-worklets": "0.7.1",
26+
"react-native-screens": "4.23.0",
27+
"react-native-worklets": "0.7.3",
2828
"superstruct": "2.0.2"
2929
},
3030
"devDependencies": {
3131
"@babel/core": "7.28.5",
3232
"@babel/preset-env": "7.28.5",
3333
"@babel/runtime": "7.28.4",
34-
"@react-native-community/cli": "20.1.0",
35-
"@react-native-community/cli-platform-android": "20.1.0",
36-
"@react-native-community/cli-platform-ios": "20.1.0",
34+
"@react-native-community/cli": "20.1.1",
35+
"@react-native-community/cli-platform-android": "20.1.1",
36+
"@react-native-community/cli-platform-ios": "20.1.1",
3737
"@react-native/babel-preset": "0.83.1",
3838
"@react-native/metro-config": "0.83.1",
3939
"@react-native/typescript-config": "0.83.1",
4040
"@types/react": "19.2.8",
4141
"babel-plugin-module-resolver": "5.0.2",
42-
"react-native-builder-bob": "0.40.17",
43-
"react-native-monorepo-config": "0.3.2"
42+
"react-native-builder-bob": "0.40.18",
43+
"react-native-monorepo-config": "0.3.3"
4444
},
4545
"engines": {
4646
"node": ">=20"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@
103103
"eslint-plugin-unused-imports": "4.3.0",
104104
"jest": "30.2.0",
105105
"lefthook": "2.0.13",
106-
"nitrogen": "0.32.0",
106+
"nitrogen": "0.33.8",
107107
"prettier": "3.7.4",
108108
"react": "19.2.3",
109109
"react-native": "0.83.1",
110110
"react-native-builder-bob": "0.40.17",
111-
"react-native-nitro-modules": "0.32.0",
111+
"react-native-nitro-modules": "0.33.8",
112112
"semantic-release": "25.0.2",
113113
"typedoc": "0.28.16",
114114
"typescript": "5.9.3"

scripts/nitrogen-patch.js

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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 `prepareToRecycleView()`
8+
* - Inserts `onDropViewInstance()`
99
* nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt
1010
*
1111
* iOS
12-
* - Inserts `+ (BOOL)shouldBeRecycled`
12+
* - Inserts `+ (void)dealloc`
1313
* nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm
1414
*/
1515
import { readFile, readdir, writeFile } from 'node:fs/promises';
@@ -70,33 +70,19 @@ const REPLACEMENTS = [
7070
const __filename = fileURLToPath(import.meta.url);
7171
const filename = basename(__filename);
7272

73-
const ANDROID_VIEW_MANAGER_METHODS =
74-
/override fun onDropViewInstance\(view: View\)\s*\{\s*super\.onDropViewInstance\(view\)\s*views\.remove\(view\)\s*\}/m;
73+
const PATCH_MARKER = ` // added by ${filename}`;
7574

76-
const ANDROID_VIEW_MANAGER_METHODS_NEW = `
75+
const ON_DROP_VIEW_INSTANCE_ANDROID = `
76+
${PATCH_MARKER}
7777
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)
7881
super.onDropViewInstance(view)
79-
views.remove(view)
80-
/// added by ${filename}
81-
if (view is GoogleMapsViewImpl) {
82-
view.destroyInternal()
83-
}
84-
}
85-
86-
/// added by ${filename}
87-
override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
88-
return null
89-
}
90-
`;
91-
92-
const RECYCLE_METHOD_IOS = `
93-
/// added by ${filename}
94-
+ (BOOL)shouldBeRecycled
95-
{
96-
return NO;
97-
}
82+
}`;
9883

99-
/// added by ${filename}
84+
const DEALLOC_METHOD_IOS = `
85+
${PATCH_MARKER}
10086
- (void)dealloc {
10187
if (_hybridView) {
10288
RNGoogleMapsPlus::HybridRNGoogleMapsPlusViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
@@ -118,28 +104,32 @@ async function processFile(filePath) {
118104
}
119105

120106
if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_MANAGER)) {
121-
if (ANDROID_VIEW_MANAGER_METHODS.test(updated)) {
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+
122116
updated = updated.replace(
123-
ANDROID_VIEW_MANAGER_METHODS,
124-
ANDROID_VIEW_MANAGER_METHODS_NEW
125-
);
126-
} else {
127-
throw new Error(
128-
`Pattern for HybridRNGoogleMapsPlusViewManager not found in ${filePath}`
117+
pattern,
118+
`$1\n${ON_DROP_VIEW_INSTANCE_ANDROID}`
129119
);
130120
}
131121
}
132122

133123
if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_COMPONENT_IOS)) {
134-
if (!/\+\s*\(BOOL\)\s*shouldBeRecycled/.test(updated)) {
135-
const pattern =
136-
/(- \(instancetype\)\s*init\s*\{(?:[^{}]|\{[^{}]*\})*\})/m;
124+
if (!updated.includes(PATCH_MARKER)) {
125+
const initPattern =
126+
/(-\s*\(instancetype\)\s*init[\s\S]*?return\s+self;\s*\})/m;
137127

138-
if (pattern.test(updated)) {
139-
updated = updated.replace(pattern, `$1\n${RECYCLE_METHOD_IOS}`);
140-
} else {
128+
if (!initPattern.test(updated)) {
141129
throw new Error(`Pattern for "init" not found in ${filePath}`);
142130
}
131+
132+
updated = updated.replace(initPattern, `$1\n${DEALLOC_METHOD_IOS}`);
143133
}
144134
}
145135

0 commit comments

Comments
 (0)