Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Map disappearing when updating the DOM #2131

Open
alexp25 opened this issue Jun 12, 2024 · 1 comment
Open

Google Map disappearing when updating the DOM #2131

alexp25 opened this issue Jun 12, 2024 · 1 comment

Comments

@alexp25
Copy link

alexp25 commented Jun 12, 2024

Bug Report

I finally found out why the map disappeared after some time on iOS. It seems to be related to dynamically adding a new element to the page where the map is created. Could someone explain why would that happen? Would the map binding break or how can this be avoided?

Plugin(s)

Google Maps

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

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

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 5.0.0
  @capacitor/core: 5.1.1
  @capacitor/ios: 5.0.0

Platform(s)

iOS

Current Behavior

The map disappears on iOS, seemingly related to dynamically adding a new element to the page where the map is created.

Expected Behavior

The map should remain visible and functional even after dynamically adding new elements to the page.

Code Reproduction

any example based on ionic angular, having a div with ngIf that is enabled after the map is initialized

Other Technical Details

Additional Context

@alexp25
Copy link
Author

alexp25 commented Jun 16, 2024

So I fixed it, it turns out that the DOM must not be changed around the map element (there should be the same structure), but it didn't prevent me from wrapping the dynamic elements in static divs (and the map no longer disappears). This needs to be added to the documentation though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants