react-native-google-maps-plus 1.0.2 → 1.1.0-dev.1

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.
Files changed (107) hide show
  1. package/README.md +127 -11
  2. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +359 -139
  3. package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +44 -44
  4. package/android/src/main/java/com/rngooglemapsplus/MapCircleBuilder.kt +19 -0
  5. package/android/src/main/java/com/rngooglemapsplus/{MapMarker.kt → MapMarkerBuilder.kt} +7 -6
  6. package/android/src/main/java/com/rngooglemapsplus/{MapPolygon.kt → MapPolygonBuilder.kt} +4 -18
  7. package/android/src/main/java/com/rngooglemapsplus/{MapPolyline.kt → MapPolylineBuilder.kt.kt} +4 -19
  8. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +145 -129
  9. package/android/src/main/java/com/rngooglemapsplus/extensions/RNCameraExtension.kt +19 -0
  10. package/android/src/main/java/com/rngooglemapsplus/extensions/RNLocationPriorityExtension.kt +12 -0
  11. package/android/src/main/java/com/rngooglemapsplus/extensions/RNMapCircleExtension.kt +14 -0
  12. package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolygonExtension.kt +20 -0
  13. package/android/src/main/java/com/rngooglemapsplus/extensions/RNPolylineExtension.kt +21 -0
  14. package/android/src/main/java/com/rngooglemapsplus/extensions/RNUserInterfaceExtension.kt +12 -0
  15. package/android/src/main/java/com/rngooglemapsplus/{Color.kt → extensions/StringExtension.kt} +1 -1
  16. package/android/src/main/java/com/rngooglemapsplus/extensions/ThrowableExtension.kt +38 -0
  17. package/ios/GoogleMapViewImpl.swift +348 -150
  18. package/ios/LocationHandler.swift +29 -69
  19. package/ios/MapCircleBuilder.swift +20 -0
  20. package/ios/{MapMarker.swift → MapMarkerBuilder.swift} +11 -42
  21. package/ios/MapPolygonBuilder.swift +20 -0
  22. package/ios/MapPolylineBuilder.swift +24 -0
  23. package/ios/PermissionHandler.swift +1 -1
  24. package/ios/RNGoogleMapsPlusModule.swift +1 -1
  25. package/ios/RNGoogleMapsPlusView.swift +159 -168
  26. package/ios/extensions/RNCamera+Extension.swift +22 -0
  27. package/ios/extensions/RNCircle+Extension.swift +24 -0
  28. package/ios/extensions/RNIOSLocationAccuracy+Extensions.swift +19 -0
  29. package/ios/extensions/RNMarker+Extension.swift +24 -0
  30. package/ios/{MapPolygon.swift → extensions/RNPolygon+Extension.swift.swift} +7 -23
  31. package/ios/extensions/RNPolyline+Extension.swift.swift +62 -0
  32. package/ios/extensions/RNUserInterface+Extension.swift +16 -0
  33. package/ios/{Color.swift → extensions/String+Extensions.swift} +20 -20
  34. package/lib/module/types.js +14 -0
  35. package/lib/module/types.js.map +1 -1
  36. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +21 -12
  37. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
  38. package/lib/typescript/src/types.d.ts +59 -3
  39. package/lib/typescript/src/types.d.ts.map +1 -1
  40. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +233 -69
  41. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +40 -22
  42. package/nitrogen/generated/android/c++/JRNAndroidLocationConfig.hpp +63 -0
  43. package/nitrogen/generated/android/c++/JRNAndroidLocationPriority.hpp +65 -0
  44. package/nitrogen/generated/android/c++/JRNCircle.hpp +84 -0
  45. package/nitrogen/generated/android/c++/JRNIOSLocationAccuracy.hpp +65 -0
  46. package/nitrogen/generated/android/c++/JRNIOSLocationConfig.hpp +59 -0
  47. package/nitrogen/generated/android/c++/JRNInitialProps.hpp +66 -0
  48. package/nitrogen/generated/android/c++/JRNLocationConfig.hpp +65 -0
  49. package/nitrogen/generated/android/c++/JRNMapType.hpp +68 -0
  50. package/nitrogen/generated/android/c++/JRNMapUiSettings.hpp +93 -0
  51. package/nitrogen/generated/android/c++/JRNMarker.hpp +4 -4
  52. package/nitrogen/generated/android/c++/JRNPolygon.hpp +8 -4
  53. package/nitrogen/generated/android/c++/JRNPolyline.hpp +8 -4
  54. package/nitrogen/generated/android/c++/views/JHybridRNGoogleMapsPlusViewStateUpdater.cpp +40 -4
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +89 -11
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNAndroidLocationConfig.kt +35 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNAndroidLocationPriority.kt +23 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNCircle.kt +50 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNIOSLocationAccuracy.kt +23 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNIOSLocationConfig.kt +32 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +35 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocationConfig.kt +32 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMapType.kt +24 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMapUiSettings.kt +59 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMarker.kt +1 -1
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNPolygon.kt +4 -1
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNPolyline.kt +4 -1
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt +7 -1
  69. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +296 -45
  70. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +27 -0
  71. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +131 -37
  72. package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +61 -16
  73. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +20 -11
  74. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +378 -45
  75. package/nitrogen/generated/ios/swift/RNAndroidLocationConfig.swift +93 -0
  76. package/nitrogen/generated/ios/swift/RNAndroidLocationPriority.swift +48 -0
  77. package/nitrogen/generated/ios/swift/RNCircle.swift +198 -0
  78. package/nitrogen/generated/ios/swift/RNIOSLocationAccuracy.swift +48 -0
  79. package/nitrogen/generated/ios/swift/RNIOSLocationConfig.swift +70 -0
  80. package/nitrogen/generated/ios/swift/RNInitialProps.swift +107 -0
  81. package/nitrogen/generated/ios/swift/RNLocationConfig.swift +84 -0
  82. package/nitrogen/generated/ios/swift/RNMapType.swift +52 -0
  83. package/nitrogen/generated/ios/swift/RNMapUiSettings.swift +277 -0
  84. package/nitrogen/generated/ios/swift/RNMarker.swift +17 -5
  85. package/nitrogen/generated/ios/swift/RNPolygon.swift +40 -5
  86. package/nitrogen/generated/ios/swift/RNPolyline.swift +40 -5
  87. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.cpp +20 -2
  88. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +59 -26
  89. package/nitrogen/generated/shared/c++/RNAndroidLocationConfig.hpp +77 -0
  90. package/nitrogen/generated/shared/c++/RNAndroidLocationPriority.hpp +64 -0
  91. package/nitrogen/generated/shared/c++/RNCircle.hpp +98 -0
  92. package/nitrogen/generated/shared/c++/RNIOSLocationAccuracy.hpp +64 -0
  93. package/nitrogen/generated/shared/c++/RNIOSLocationConfig.hpp +73 -0
  94. package/nitrogen/generated/shared/c++/RNInitialProps.hpp +78 -0
  95. package/nitrogen/generated/shared/c++/RNLocationConfig.hpp +76 -0
  96. package/nitrogen/generated/shared/c++/RNMapType.hpp +88 -0
  97. package/nitrogen/generated/shared/c++/RNMapUiSettings.hpp +107 -0
  98. package/nitrogen/generated/shared/c++/RNMarker.hpp +6 -6
  99. package/nitrogen/generated/shared/c++/RNPolygon.hpp +10 -6
  100. package/nitrogen/generated/shared/c++/RNPolyline.hpp +10 -6
  101. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.cpp +138 -30
  102. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.hpp +27 -13
  103. package/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +10 -1
  104. package/package.json +5 -5
  105. package/src/RNGoogleMapsPlusView.nitro.ts +25 -11
  106. package/src/types.ts +67 -3
  107. package/ios/MapPolyline.swift +0 -83
package/README.md CHANGED
@@ -1,30 +1,146 @@
1
1
  # react-native-google-maps-plus
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/react-native-google-maps-plus.svg)](https://www.npmjs.com/package/react-native-google-maps-plus)
3
+ [![npm version](https://img.shields.io/npm/v/react-native-google-maps-plus.svg?logo=npm&color=cb0000)](https://www.npmjs.com/package/react-native-google-maps-plus)
4
+ [![Dev Release](https://img.shields.io/npm/v/react-native-google-maps-plus/dev.svg?label=dev%20release&color=orange&logo=githubactions)](https://www.npmjs.com/package/react-native-google-maps-plus)
4
5
  [![Release](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml/badge.svg)](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml)
5
- [![Issues](https://img.shields.io/github/issues/pinpong/react-native-google-maps-plus)](https://github.com/pinpong/react-native-google-maps-plus/issues)
6
- [![License](https://img.shields.io/github/license/pinpong/react-native-google-maps-plus)](./LICENSE)
7
- [![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/)
8
- [![TypeScript](https://img.shields.io/badge/%3C/%3E-TypeScript-blue.svg)](https://www.typescriptlang.org/)
9
- [![Lint](https://img.shields.io/badge/lint-eslint-green.svg)](https://eslint.org/)
10
- [![React Native](https://img.shields.io/badge/react--native-%3E%3D0.81.0-61dafb.svg)](https://reactnative.dev/)
11
- [![Platform: Android](https://img.shields.io/badge/platform-android-green.svg)](https://developer.android.com/)
12
- [![Platform: iOS](https://img.shields.io/badge/platform-iOS-lightgrey.svg)](https://developer.apple.com/ios/)
6
+ [![Issues](https://img.shields.io/github/issues/pinpong/react-native-google-maps-plus?logo=github)](https://github.com/pinpong/react-native-google-maps-plus/issues)
7
+ [![License](https://img.shields.io/github/license/pinpong/react-native-google-maps-plus?logo=open-source-initiative&logoColor=green)](./LICENSE)
8
+ [![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier&logoColor=white)](https://prettier.io/)
9
+ [![TypeScript](https://img.shields.io/badge/%3C/%3E-TypeScript-blue.svg?logo=typescript)](https://www.typescriptlang.org/)
10
+ [![Lint](https://img.shields.io/badge/lint-eslint-green.svg?logo=eslint&logoColor=white)](https://eslint.org/)
11
+ [![React Native](https://img.shields.io/badge/react--native-%3E%3D0.81.0-61dafb.svg?logo=react)](https://reactnative.dev/)
12
+ [![Platform: Android](https://img.shields.io/badge/platform-android-green.svg?logo=android&logoColor=white)](https://developer.android.com/)
13
+ [![Platform: iOS](https://img.shields.io/badge/platform-iOS-lightgrey.svg?logo=apple&logoColor=black)](https://developer.apple.com/ios/)
13
14
 
14
15
  React-native wrapper for android & IOS google maps sdk
15
16
 
16
17
  ## Installation
17
18
 
19
+ `react-native-nitro-modules` is required as this library relies on [Nitro Modules](https://nitro.margelo.com/).
20
+
18
21
  ```sh
19
22
  yarn add react-native-google-maps-plus react-native-nitro-modules
20
-
21
- > `react-native-nitro-modules` is required as this library relies on [Nitro Modules](https://nitro.margelo.com/).
22
23
  ```
23
24
 
25
+ Dependencies
26
+
27
+ This package builds on native SVG rendering libraries:
28
+
29
+ iOS: [SVGKit](https://github.com/SVGKit/SVGKit)
30
+
31
+ Android: [AndroidSVG](https://bigbadaboom.github.io/androidsvg/)
32
+
33
+ These are automatically linked when you install the package, but you may need to clean/rebuild your native projects after first install.
34
+
35
+ ## Setup API Key
36
+
37
+ You will need a valid **Google Maps API Key** from the [Google Cloud Console](https://console.cloud.google.com/).
38
+
39
+ ### Android
40
+
41
+ It's recommend to use [Secrets Gradle Plugin](https://developers.google.com/maps/documentation/android-sdk/secrets-gradle-plugin) to securely manage your Google Maps API Key.
42
+
43
+ ---
44
+
45
+ ### iOS
46
+
47
+ See the official [Google Maps iOS SDK configuration guide](https://developers.google.com/maps/documentation/ios-sdk/config#get-key) for more details.
48
+
49
+ 1. Create a `Secrets.xcconfig` file inside the **ios/** folder:
50
+
51
+ ```properties
52
+ MAPS_API_KEY=YOUR_IOS_MAPS_API_KEY
53
+ ```
54
+
55
+ Include it in your project configuration file:
56
+
57
+ ```xcconfig
58
+ #include? "Secrets.xcconfig"
59
+ ```
60
+
61
+ 2. Reference the API key in your **Info.plist**:
62
+
63
+ ```xml
64
+ <key>MAPS_API_KEY</key>
65
+ <string>$(MAPS_API_KEY)</string>
66
+ ```
67
+
68
+ 3. Provide the key programmatically in **AppDelegate.swift**:
69
+
70
+ ```swift
71
+ import GoogleMaps
72
+
73
+ @UIApplicationMain
74
+ class AppDelegate: UIResponder, UIApplicationDelegate {
75
+ func application(_ application: UIApplication,
76
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
77
+ if let apiKey = Bundle.main.object(forInfoDictionaryKey: "MAPS_API_KEY") as? String {
78
+ GMSServices.provideAPIKey(apiKey)
79
+ }
80
+ return true
81
+ }
82
+ }
83
+ ```
84
+
85
+ ---
86
+
24
87
  ## Usage
25
88
 
26
89
  Checkout the example app in the [example](./example) folder.
27
90
 
91
+ # Troubleshooting
92
+
93
+ ## Android
94
+
95
+ - **API key not found**
96
+ Make sure `secrets.properties` exists under `android/` and contains your `MAPS_API_KEY`.
97
+ Run `./gradlew clean` and rebuild.
98
+
99
+ ## iOS
100
+
101
+ - **`GMSServices must be configured before use`**
102
+ Ensure your key is in `Info.plist` and/or provided via `GMSServices.provideAPIKey(...)` in `AppDelegate.swift`.
103
+
104
+ - **Build fails with `Node.h` import error from SVGKit**
105
+ SVGKit uses a header `Node.h` which can conflict with iOS system headers.
106
+ You can patch it automatically in your **Podfile** inside the `post_install` hook:
107
+
108
+ ```ruby
109
+ post_install do |installer|
110
+ react_native_post_install(
111
+ installer,
112
+ config[:reactNativePath],
113
+ :mac_catalyst_enabled => false,
114
+ )
115
+ # Force iOS 16+ to avoid deployment target warnings
116
+ installer.pods_project.targets.each do |target|
117
+ target.build_configurations.each do |config|
118
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
119
+ end
120
+ end
121
+
122
+ # Patch SVGKit includes to avoid Node.h conflicts
123
+ require 'fileutils'
124
+ svgkit_path = File.join(installer.sandbox.pod_dir('SVGKit'), 'Source')
125
+ Dir.glob(File.join(svgkit_path, '**', '*.{h,m}')).each do |file|
126
+ FileUtils.chmod("u+w", file)
127
+ text = File.read(file)
128
+ new_contents = text.gsub('#import "Node.h"', '#import "SVGKit/Node.h"')
129
+ File.open(file, 'w') { |f| f.write(new_contents) }
130
+ end
131
+ end
132
+ ```
133
+
134
+ After applying this, run:
135
+
136
+ ```sh
137
+ cd ios && pod install --repo-update
138
+ ```
139
+
140
+ - **Maps not rendering**
141
+ - Check that your API key has **Maps SDK for Android/iOS** enabled in Google Cloud Console.
142
+ - Make sure the key is not restricted to wrong bundle IDs or SHA1 fingerprints.
143
+
28
144
  ## Contributing
29
145
 
30
146
  - [Development workflow](CONTRIBUTING.md#development-workflow)