File tree Expand file tree Collapse file tree 6 files changed +461
-401
lines changed
Expand file tree Collapse file tree 6 files changed +461
-401
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,25 @@ const MyMap: React.FC = () => {
245245export default MyMap ;
246246```
247247
248+ You may need to create a ` *.d.ts ` file for the custom element in React:
249+
250+ ``` ts
251+ // custom-elements.d.ts
252+
253+ declare module " react" {
254+ namespace JSX {
255+ interface IntrinsicElements {
256+ " capacitor-google-map" : React .DetailedHTMLProps <
257+ React .HTMLAttributes <HTMLElement >,
258+ HTMLElement
259+ >;
260+ }
261+ }
262+ }
263+
264+ export {};
265+ ```
266+
248267### Vue
249268
250269``` vue
Original file line number Diff line number Diff line change 1- import '@capacitor/google-maps' ;
2-
3- declare global {
1+ declare module "react" {
42 namespace JSX {
53 interface IntrinsicElements {
6- 'capacitor-google-map' : React . DetailedHTMLProps < React . HTMLAttributes < HTMLElement > , HTMLElement > ;
4+ "capacitor-google-map" : React . DetailedHTMLProps <
5+ React . HTMLAttributes < HTMLElement > ,
6+ HTMLElement
7+ > ;
78 }
89 }
910}
1011
1112export { } ;
12-
Original file line number Diff line number Diff line change @@ -245,6 +245,25 @@ const MyMap: React.FC = () => {
245245export default MyMap ;
246246```
247247
248+ You may need to create a ` *.d.ts ` file for the custom element in React:
249+
250+ ``` ts
251+ // custom-elements.d.ts
252+
253+ declare module " react" {
254+ namespace JSX {
255+ interface IntrinsicElements {
256+ " capacitor-google-map" : React .DetailedHTMLProps <
257+ React .HTMLAttributes <HTMLElement >,
258+ HTMLElement
259+ >;
260+ }
261+ }
262+ }
263+
264+ export {};
265+ ```
266+
248267### Vue
249268
250269``` vue
Original file line number Diff line number Diff line change 6969 "@typescript-eslint/eslint-plugin" : " ^8.48.0" ,
7070 "@typescript-eslint/parser" : " ^8.48.0" ,
7171 "downlevel-dts" : " ^0.11.0" ,
72- "eslint" : " ^9.39 .1" ,
72+ "eslint" : " ^8.57 .1" ,
7373 "eslint-config-prettier" : " ^10.1.8" ,
7474 "eslint-plugin-import" : " ^2.32.0" ,
7575 "prettier" : " ^3.6.2" ,
9595 "access" : " public"
9696 },
9797 "dependencies" : {
98- "@googlemaps/js-api-loader" : " ~1.16.8 " ,
99- "@googlemaps/markerclusterer" : " ~2.5.3 " ,
100- "@types/google.maps" : " ~ 3.58.1"
98+ "@googlemaps/js-api-loader" : " ^2.0.2 " ,
99+ "@googlemaps/markerclusterer" : " ^2.6.2 " ,
100+ "@types/google.maps" : " ^ 3.58.1"
101101 }
102102}
Original file line number Diff line number Diff line change @@ -122,13 +122,13 @@ export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogle
122122 private async importGoogleLib ( apiKey : string , region ?: string , language ?: string ) {
123123 if ( this . gMapsRef === undefined ) {
124124 const lib = await import ( '@googlemaps/js-api-loader' ) ;
125- const loader = new lib . Loader ( {
126- apiKey : apiKey ?? '' ,
127- version : 'weekly' ,
125+ lib . setOptions ( {
126+ key : apiKey ?? '' ,
128127 language,
129128 region,
130129 } ) ;
131- this . gMapsRef = await loader . importLibrary ( 'maps' ) ;
130+
131+ this . gMapsRef = await lib . importLibrary ( 'maps' ) ;
132132
133133 // Import marker library once
134134 const { AdvancedMarkerElement, PinElement } = ( await google . maps . importLibrary (
You can’t perform that action at this time.
0 commit comments