'nav-decor' hides GoogleMap
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
Hello, thanks for opening an issue with us! Would you be able to provide a repo that demonstrates this issue? Thanks for using Ionic!
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);
}
That way is better than mine, I'll provide an example of the bug later today :)
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!
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.
Same for me with the last nightly.
I used the solution by @lthh89vt , and it is working great !
+1 for the @lthh89vt solution! It's working for me too.
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.
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.

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

back to map:

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;
}
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.
@jgw96 i am facing the same issue on iOS. Can someone please make this a priority?
+1
+5
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.
Getting the same issue. Map on iOS causes black background instead, CSS tricks didn't work.
Try display none, it works for me:
ion-app._gmaps_cdv_ .nav-decor{
display: none !important;
}
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...
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!
app.scss
ion-app.gmaps_cdv .nav-decor{ background-color: transparent !important; }
works for me
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?