Skip to content

Google Map not showing on IOS if the html element has border #124

@sbdm05

Description

@sbdm05

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.5.1
  @capacitor/core: 5.5.1
  @capacitor/android: 5.5.1
  @capacitor/ios: 5.5.1

Installed Dependencies:

  @capacitor/cli: 5.5.0
  @capacitor/core: 5.5.0
  @capacitor/android: 5.5.0
  @capacitor/ios: 5.5.0


Platform(s)

IOS

Current Behavior

@ViewChild('citymap') mapRef!: ElementRef<HTMLElement>;
private newMap!: GoogleMap;

async createMap() {
  try {
    
    this.newMap = await GoogleMap.create({
      id: 'citymap',
      element: this.mapRef.nativeElement,
      apiKey: 'API_KEY',
      config: {
        center: {
          lat: 48.992128,
          lng: 2.2779189,
        },
        zoom: 12,
      },
    });

    console.log(this.mapRef.nativeElement); // not showing up at all on IOS
  } catch (error) {
    console.error('Error fetching or processing the map:', error); // error not explicit
 
  }

ngAfterViewInit() {

  this.platform.ready().then(() => {
    console.log('platform is ready');

    if (this.platform.is('ios')) {
      this.createMap();
    } else if (this.platform.is('android')) { 
      this.createMap();
    } else {
      console.log('inside else');
      this.createMap();
    }
  });
}

Expected Behavior

The map does show up in browser and Android, but not on IOS.
On the browser version, the console.log(this.mapRef.nativeElement) logs the DIV
<capacitor-google-map #citymap>// all the divs here are visible</capacitor-google-map>

On the IOS version, when inspecting with safari, the DIV in the DOM is empty

<capacitor-google-map _ngcontent-ng-c1814317578="" id="citymap" style="overflow: scroll; -webkit-overflow-scrolling: touch;">
<div style="height: 200%;"></div>
</capacitor-google-map>

Code Reproduction

Other Technical Details

npm --version output: 10.2.3

node --version output:v20.10.0

pod --version output (iOS issues only):1.14.3

Additional Context

I have installed a blank project also to isolate the issue, no luck there either.
I have deleted the ios folder, reinstall ios, no difference.
I have added transparency as it is sometimes a recommendation, but no change either.

Thank you very much for your help (it has been days)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions