react-native-google-maps-plus 1.8.6 → 1.8.7

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/README.md CHANGED
@@ -25,47 +25,14 @@ Add this to your Podfile only for bare React Native apps.
25
25
  ```ruby
26
26
  post_install do |installer|
27
27
  react_native_post_install(
28
- installer,
29
- config[:reactNativePath],
30
- :mac_catalyst_enabled => false,
31
- )
32
- # Force iOS 16+ to avoid deployment target warnings
33
- installer.pods_project.targets.each do |target|
34
- target.build_configurations.each do |config|
35
- config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
36
- end
37
- end
38
-
39
- # --- SVGKit Patch ---
40
- require 'fileutils'
41
- svgkit_path = File.join(installer.sandbox.pod_dir('SVGKit'), 'Source')
42
-
43
- # node fix
44
- Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|
45
- FileUtils.chmod("u+w", file)
46
- text = File.read(file)
47
- new_contents = text.gsub('#import "Node.h"', '#import "SVGKit/Node.h"')
48
- File.open(file, 'w') { |f| f.write(new_contents) }
49
- # puts "Patched Node import in: #{file}"
50
- end
51
-
52
- # import CSSValue.h
53
- Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|
54
- FileUtils.chmod("u+w", file)
55
- text = File.read(file)
56
- new_contents = text.gsub('#import "CSSValue.h"', '#import "SVGKit/CSSValue.h"')
57
- File.open(file, 'w') { |f| f.write(new_contents) }
58
- # puts "Patched CSSValue import in: #{file}"
59
- end
60
-
61
- # import SVGLength.h
62
- Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|
63
- FileUtils.chmod("u+w", file)
64
- text = File.read(file)
65
- new_contents = text.gsub('#import "SVGLength.h"', '#import "SVGKit/SVGLength.h"')
66
- File.open(file, 'w') { |f| f.write(new_contents) }
67
- # puts "Patched SVGLength import in: #{file}"
68
- end
28
+ installer,
29
+ config[:reactNativePath],
30
+ :mac_catalyst_enabled => false,
31
+ # :ccache_enabled => true
32
+ )
33
+
34
+ require_relative '../node_modules/react-native-google-maps-plus/scripts/svgkit_patch'
35
+ apply_svgkit_patch(installer)
69
36
  end
70
37
  ```
71
38
 
@@ -345,7 +345,14 @@ class GoogleMapsViewImpl(
345
345
  var userInterfaceStyle: Int? = null
346
346
  set(value) {
347
347
  field = value
348
- onUi { googleMap?.mapColorScheme = value ?: MapColorScheme.FOLLOW_SYSTEM }
348
+ onUi {
349
+ try {
350
+ // / not supported when liteMode enabled on latest renderer
351
+ googleMap?.mapColorScheme = value ?: MapColorScheme.FOLLOW_SYSTEM
352
+ } catch (_: UnsupportedOperationException) {
353
+ // / ignore
354
+ }
355
+ }
349
356
  }
350
357
 
351
358
  var mapZoomConfig: RNMapZoomConfig? = null
@@ -26,16 +26,16 @@ var withIosGoogleMapsPlus = function (config, props) {
26
26
  comment: '#',
27
27
  }).contents;
28
28
  }
29
- var patchSnippet = "\n # Force iOS 16+ to avoid deployment target warnings\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'\n end\n end\n\n # --- SVGKit Patch ---\n require 'fileutils'\n svgkit_path = File.join(installer.sandbox.pod_dir('SVGKit'), 'Source')\n\n # --- Patch Node.h imports ---\n Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|\n FileUtils.chmod(\"u+w\", file)\n text = File.read(file)\n new_contents = text.gsub('#import \"Node.h\"', '#import \"SVGKit/Node.h\"')\n File.open(file, 'w') { |f| f.write(new_contents) }\n end\n\n # --- Patch CSSValue.h imports ---\n Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|\n FileUtils.chmod(\"u+w\", file)\n text = File.read(file)\n new_contents = text.gsub('#import \"CSSValue.h\"', '#import \"SVGKit/CSSValue.h\"')\n File.open(file, 'w') { |f| f.write(new_contents) }\n end\n\n # --- Patch SVGLength.h imports ---\n Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|\n FileUtils.chmod(\"u+w\", file)\n text = File.read(file)\n new_contents = text.gsub('#import \"SVGLength.h\"', '#import \"SVGKit/SVGLength.h\"')\n File.open(file, 'w') { |f| f.write(new_contents) }\n end\n ";
29
+ var podFilePatch = "\n require_relative '../node_modules/react-native-google-maps-plus/scripts/svgkit_patch'\n apply_svgkit_patch(installer)\n ";
30
30
  if (src.includes('post_install do |installer|')) {
31
31
  src = src.replace(/post_install do \|installer\|([\s\S]*?)end/, function (match, inner) {
32
32
  if (inner.includes('SVGKit Patch'))
33
33
  return match; // idempotent
34
- return "post_install do |installer|".concat(inner, "\n").concat(patchSnippet, "\nend");
34
+ return "post_install do |installer|".concat(inner, "\n").concat(podFilePatch, "\nend");
35
35
  });
36
36
  }
37
37
  else {
38
- src += "\npost_install do |installer|\n".concat(patchSnippet, "\nend\n");
38
+ src += "\npost_install do |installer|\n".concat(podFilePatch, "\nend\n");
39
39
  }
40
40
  conf.modResults.contents = src;
41
41
  return conf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-maps-plus",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "description": "React Native wrapper for Android & iOS Google Maps SDK",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -63,6 +63,7 @@
63
63
  "ios/**/*.swift",
64
64
  "app.plugin.js",
65
65
  "*.podspec",
66
+ "scripts",
66
67
  "README.md"
67
68
  ],
68
69
  "workspaces": [
@@ -88,6 +89,7 @@
88
89
  "@react-native/babel-preset": "0.82.1",
89
90
  "@react-native/eslint-config": "0.82.1",
90
91
  "@semantic-release/changelog": "6.0.3",
92
+ "@semantic-release/exec": "7.1.0",
91
93
  "@semantic-release/git": "10.0.1",
92
94
  "@semantic-release/npm": "13.1.1",
93
95
  "@types/jest": "30.0.0",
@@ -101,12 +103,12 @@
101
103
  "eslint-plugin-prettier": "5.5.4",
102
104
  "jest": "30.2.0",
103
105
  "lefthook": "2.0.2",
104
- "nitrogen": "0.31.4",
106
+ "nitrogen": "0.31.5",
105
107
  "prettier": "3.6.2",
106
108
  "react": "19.1.1",
107
109
  "react-native": "0.82.1",
108
110
  "react-native-builder-bob": "0.40.14",
109
- "react-native-nitro-modules": "0.31.4",
111
+ "react-native-nitro-modules": "0.31.5",
110
112
  "semantic-release": "25.0.1",
111
113
  "typescript": "5.9.3"
112
114
  },
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Recursively patches all generated Nitro files (Android & iOS):
3
+ *
4
+ * ANDROID
5
+ * - Replaces 'com.margelo.nitro.rngooglemapsplus' -> 'com.rngooglemapsplus'
6
+ * - Replaces 'com/margelo/nitro/rngooglemapsplus' -> 'com/rngooglemapsplus'
7
+ * - Removes 'margelo/nitro/' in RNGoogleMapsPlusOnLoad.cpp
8
+ * - Inserts `prepareToRecycleView()`
9
+ * nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt
10
+ *
11
+ * iOS
12
+ * - Inserts `+ (BOOL)shouldBeRecycled`
13
+ * nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm
14
+ */
15
+ import { fileURLToPath } from 'url';
16
+ import { basename } from 'path';
17
+ import path from 'node:path';
18
+ import { readdir, readFile, writeFile } from 'node:fs/promises';
19
+ import { mkdir, copyFile } from 'node:fs/promises';
20
+
21
+ const ROOT_ANDROID = path.join(
22
+ process.cwd(),
23
+ 'nitrogen',
24
+ 'generated',
25
+ 'android'
26
+ );
27
+ const ROOT_IOS = path.join(process.cwd(), 'nitrogen', 'generated', 'ios');
28
+ const SRC_JSON_DIR = path.join(
29
+ process.cwd(),
30
+ 'nitrogen',
31
+ 'generated',
32
+ 'shared',
33
+ 'json'
34
+ );
35
+ const DEST_JSON_DIR = path.join(
36
+ process.cwd(),
37
+ 'lib',
38
+ 'nitrogen',
39
+ 'generated',
40
+ 'shared',
41
+ 'json'
42
+ );
43
+
44
+ const ANDROID_ONLOAD_FILE = path.join(
45
+ ROOT_ANDROID,
46
+ 'RNGoogleMapsPlusOnLoad.cpp'
47
+ );
48
+
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
+
59
+ const REPLACEMENTS = [
60
+ {
61
+ regex: /com\.margelo\.nitro\.rngooglemapsplus/g,
62
+ replacement: 'com.rngooglemapsplus',
63
+ },
64
+ {
65
+ regex: /com\/margelo\/nitro\/rngooglemapsplus/g,
66
+ replacement: 'com/rngooglemapsplus',
67
+ },
68
+ ];
69
+
70
+ const __filename = fileURLToPath(import.meta.url);
71
+ const filename = basename(__filename);
72
+
73
+ const ANDROID_VIEW_MANAGER_METHODS =
74
+ /override fun onDropViewInstance\(view: View\)\s*\{\s*super\.onDropViewInstance\(view\)\s*views\.remove\(view\)\s*\}/m;
75
+
76
+ const ANDROID_VIEW_MANAGER_METHODS_NEW = `
77
+ override fun onDropViewInstance(view: View) {
78
+ 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
+ }
98
+
99
+ /// added by ${filename}
100
+ - (void)dealloc {
101
+ if (_hybridView) {
102
+ RNGoogleMapsPlus::HybridRNGoogleMapsPlusViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
103
+ swiftPart.dispose();
104
+ _hybridView.reset();
105
+ }
106
+ }`;
107
+
108
+ async function processFile(filePath) {
109
+ let content = await readFile(filePath, 'utf8');
110
+ let updated = content;
111
+
112
+ for (const { regex, replacement } of REPLACEMENTS) {
113
+ updated = updated.replace(regex, replacement);
114
+ }
115
+
116
+ if (path.resolve(filePath) === path.resolve(ANDROID_ONLOAD_FILE)) {
117
+ updated = updated.replace(/margelo\/nitro\//g, '');
118
+ }
119
+
120
+ if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_MANAGER)) {
121
+ if (ANDROID_VIEW_MANAGER_METHODS.test(updated)) {
122
+ 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}`
129
+ );
130
+ }
131
+ }
132
+
133
+ 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;
137
+
138
+ if (pattern.test(updated)) {
139
+ updated = updated.replace(pattern, `$1\n${RECYCLE_METHOD_IOS}`);
140
+ } else {
141
+ throw new Error(`Pattern for "init" not found in ${filePath}`);
142
+ }
143
+ }
144
+ }
145
+
146
+ if (updated !== content) {
147
+ await writeFile(filePath, updated, 'utf8');
148
+ console.log(`Updated: ${filePath}`);
149
+ }
150
+ }
151
+
152
+ async function start(dir) {
153
+ const entries = await readdir(dir, { withFileTypes: true });
154
+ for (const entry of entries) {
155
+ const fullPath = path.join(dir, entry.name);
156
+ if (entry.isDirectory()) {
157
+ await start(fullPath);
158
+ } else if (entry.isFile()) {
159
+ await processFile(fullPath);
160
+ }
161
+ }
162
+ }
163
+
164
+ async function copyJsonFiles() {
165
+ try {
166
+ await mkdir(DEST_JSON_DIR, { recursive: true });
167
+ const files = await readdir(SRC_JSON_DIR);
168
+ for (const file of files) {
169
+ if (file.endsWith('.json')) {
170
+ const src = path.join(SRC_JSON_DIR, file);
171
+ const dest = path.join(DEST_JSON_DIR, file);
172
+ await copyFile(src, dest);
173
+ console.log(`Copied JSON: ${file}`);
174
+ }
175
+ }
176
+ } catch (err) {
177
+ console.warn('Failed to copy JSON view configs:', err.message);
178
+ }
179
+ }
180
+
181
+ (async () => {
182
+ try {
183
+ await copyJsonFiles();
184
+ await start(ROOT_ANDROID);
185
+ await start(ROOT_IOS);
186
+ console.log('All Nitrogen files patched successfully.');
187
+ } catch (err) {
188
+ console.error('Error while processing files:', err);
189
+ process.exit(1);
190
+ }
191
+ })();
@@ -0,0 +1,41 @@
1
+ def apply_svgkit_patch(installer)
2
+ svgkit_path = File.join(installer.sandbox.root, "SVGKit", "Source")
3
+ return unless Dir.exist?(svgkit_path)
4
+
5
+ package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
6
+ package_name = package["name"]
7
+
8
+ puts "[#{package_name}] Applying SVGKit patch..."
9
+
10
+ files = Dir.glob(File.join(svgkit_path, "**/*.{h,m}"))
11
+
12
+ replacements = {
13
+ '#import "Node.h"' => '#import "SVGKit/Node.h"',
14
+ '#import "CSSValue.h"' => '#import "SVGKit/CSSValue.h"',
15
+ '#import "SVGLength.h"' => '#import "SVGKit/SVGLength.h"'
16
+ }
17
+
18
+ count = 0
19
+
20
+ files.each do |file|
21
+ text = File.read(file)
22
+ new_text = text.dup
23
+
24
+ replacements.each do |original, patched|
25
+ new_text.gsub!(original, patched)
26
+ end
27
+
28
+ next if new_text == text
29
+
30
+ File.write(file, new_text)
31
+ count += 1
32
+ end
33
+
34
+ if count > 0
35
+ puts "[#{package_name}] SVGKit patch applied (#{count} files modified)"
36
+ else
37
+ puts "[#{package_name}] SVGKit was already patched or no matches"
38
+ end
39
+
40
+
41
+ end