ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

'nav-decor' hides GoogleMap

Open guillenotfound opened this issue 10 years ago • 37 comments

Short description of the problem:

Since this commit: https://github.com/driftyco/ionic/commit/7842991c1a0771639df5e7c7df0eed47549c5a00

There is a black layer between the touchable transparent layer and the map while using https://github.com/mapsplugin/cordova-plugin-googlemaps plugin on iOS platform.

What behavior are you expecting?

See the map. Workaround:

 ionViewWillEnter(): void {
    document.getElementsByClassName('nav-decor')[2].className += ' hide';
    document.getElementsByClassName('nav-decor')[3].className += ' hide';
  }

  ionViewWillLeave(): void {
    document.getElementsByClassName('nav-decor')[2].className = 'nav-decor';
    document.getElementsByClassName('nav-decor')[3].className = 'nav-decor';
  }

I have a tabs template with 3 tabs.

Which Ionic Version? 1.x or 2.x 2.0.0-beta.10

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.2.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.3.0
Xcode version: Xcode 8.0 Build version 8S128d

guillenotfound avatar Jul 05 '16 09:07 guillenotfound

Hello, thanks for opening an issue with us! Would you be able to provide a repo that demonstrates this issue? Thanks for using Ionic!

jgw96 avatar Jul 05 '16 15:07 jgw96

I'm having exact same issue.

nav-decor created a black layer on top of the map.

My way to fix it is using css

ion-app._gmaps_cdv_ .nav-decor {
    background-color: rgba(0,0,0,0);
}

kat3su avatar Jul 07 '16 04:07 kat3su

That way is better than mine, I'll provide an example of the bug later today :)

guillenotfound avatar Jul 07 '16 09:07 guillenotfound

Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic!

jgw96 avatar Jul 13 '16 15:07 jgw96

This still an 'issue' after updating my app to latest nightly.

Demo: https://drive.google.com/file/d/0B5rCifUQQ0c4R1ZvTFIzOXZRQVU/view?usp=sharing If I remove from safari nav-decor layer I can see the map.

I'll keep disabled the transitioning shadow on maps, that seems to be the best solution.

guillenotfound avatar Jul 18 '16 15:07 guillenotfound

Same for me with the last nightly.

I used the solution by @lthh89vt , and it is working great !

tgensol avatar Jul 31 '16 02:07 tgensol

+1 for the @lthh89vt solution! It's working for me too.

pekastel avatar Jul 31 '16 19:07 pekastel

Same issue still afecting with ionic 2.0.0 beta 11, and solved with trick from @lthh89vt

@jgw96: as this is not caused by the plugin but by the nav-decor layer that ionic adds, shouldn't this issue be left open until it is solved? Maybe @lthh89vt solution must be included in ionic CSS.

kaikcreator avatar Aug 06 '16 14:08 kaikcreator

Hi all, this problem still affect on my project.

Here is my development environment: Cordova CLI: 6.3.0 Gulp version: CLI version 3.9.1 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.10 Ionic CLI Version: 2.0.0-beta.37 Ionic App Lib Version: 2.0.0-beta.20 ios-deploy version: 1.8.6 ios-sim version: 3.1.1 OS: Mac OS X El Capitan Node Version: v4.4.3 Xcode version: Xcode 7.3 Build version 7D175

I have to enable the scss code for nav-decor

ion-app._gmaps_cdv_ .nav-decor{
  background-color: transparent !important;
}

I have to say yes it works for me temporarily. However, on my project, I have got multiple tabs then it cause the following problem: After I boot up the application, It looks OK. snip20160814_4

However, once I am going to other tab and back. It shows me this screen.

Other screen: snip20160814_5

back to map: snip20160814_6

These two screens have been puts together, and the google map is missing....

Anybody have ideas to help me gets out of this "hole" please?

there is my code for map:


import {Component} from "@angular/core";
import {NavController, Platform} from 'ionic-angular';
import {GoogleMap, GoogleMapsEvent, GoogleMapsLatLng, GoogleMapsMarkerOptions,Geolocation} from 'ionic-native';

@Component({
  templateUrl: 'build/pages/maps/maps.html'
})

export class MapsPage {
  private map: GoogleMap;

  constructor(private _navController: NavController,private platform: Platform) {
    this.platform.ready().then(() => this.onPlatformReady());
  }
  private onPlatformReady(): void {
    GoogleMap.isAvailable().then(() => {
      this.map = new GoogleMap('map_canvas');
      this.map.one(GoogleMapsEvent.MAP_READY).then((data: any) => {
        let myPosition = new GoogleMapsLatLng(38.9072, -77.0369);
        console.log("My position is", myPosition);
      });
      this.map.setBackgroundColor("white");
      this.map.setMyLocationEnabled(true);
    });
  }
}


html :

<ion-header>
  <ion-navbar>
    <ion-title>
      Maps View
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content>
  <h2>hihi</h2>
    <div id="map_canvas">

    </div>
</ion-content>


scss file


.maps {

}
ion-app._gmaps_cdv_ .nav-decor{
  background-color: transparent !important;
}

infinitysky avatar Aug 14 '16 02:08 infinitysky

The issue still exists in 2.0.0.rc2 and I think it should still be fixed cause people like me keep running into this and it took me a while to find the CSS hack above.

@jgw96 please re-open this ticket here because I did not find another one that's open and trackable.

DavidTalamona avatar Nov 16 '16 21:11 DavidTalamona

@jgw96 i am facing the same issue on iOS. Can someone please make this a priority?

kodeine avatar Nov 20 '16 04:11 kodeine

+1

tgensol avatar Nov 20 '16 09:11 tgensol

+5

EralpB avatar Dec 06 '16 18:12 EralpB

Same here, and none of the CSS tricks work for me. The map still doesn't show. I am however getting API Requests recorded on the Google Console, so the calls are being made, but the map is not being displayed.

dimitri320 avatar Feb 28 '17 21:02 dimitri320

Getting the same issue. Map on iOS causes black background instead, CSS tricks didn't work.

lukeb2014 avatar Mar 28 '17 22:03 lukeb2014

Try display none, it works for me:

ion-app._gmaps_cdv_ .nav-decor{
    display: none !important;
}

kaikcreator avatar Mar 29 '17 10:03 kaikcreator

Fyi: For me the Map only works in "pages" not in modals. So maybe try to set your "map-page" as root page and don't modalCtrl.create(..).present() it...

dominikstrasser avatar Mar 29 '17 12:03 dominikstrasser

I added that css @kaikcreator and it didn't work. However, the code is correct as when I open safari inspector and set nav-decor to display: none it works. I probably need to clean and rebuild and it'll work fine, or I need to adjust the css element. Thanks!

Edit: I had it in my page's scss. I looked and apparently nav-decor is outside of the page element, so I needed to put the scss in app.scss. Now it works perfectly. Again, thank you so much!

lukeb2014 avatar Mar 30 '17 17:03 lukeb2014

app.scss

ion-app.gmaps_cdv .nav-decor{ background-color: transparent !important; }

works for me

hamdiceylan avatar Apr 15 '17 14:04 hamdiceylan

I have the same issue:

Cordova CLI: 6.5.0 Ionic Framework Version: 2.0.0 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.1.4 ios-deploy version: 1.9.0 ios-sim version: Not installed OS: macOS Sierra Node Version: v7.6.0 Xcode version: Xcode 8.3.2 Build version 8E2002

Ionic native 3.5

I also have the issue on Android. We are trying to display the map in a small container on the page and the cordova js is walking up the DOM making any parents black.

Can somebody help?

szankelDvag avatar Apr 28 '17 13:04 szankelDvag