White flash when call map.remove() or map.getMap()

434 Views Asked by At

I'm using the maps plugin (version 1) in the Cordova app: https://github.com/mapsplugin

When to go to the map page or go the other page from the map page, on the app, there is a quick white flash. It displaying a white screen and then disappear after about 0.5s, then the app works normally.
Perhaps the both map.remove() and map.getMap() function is not work smoothly.
This issue happens on the both android and ios.
I know that the plugin changes the background-color of the map div and the parent elements as transparent. After I call the remove function, it will remove all inline style of map div and parent elements. This may be the cause. But I don't know how to resolve it.
Please help me resolve it. Thanks.

$scope.initNativeMap = function () {
        var div = document.getElementById("map_canvas");
        // Initialize the map view
        map = plugin.google.maps.Map.getMap(div);
        map.addEventListener(plugin.google.maps.event.MAP_READY, onMapReady);
    };

    function onMapReady() {
        console.log("map ready >> find current location");
        mixpanel.track("Map: initiliazed");
        $scope.getLocation();
    };

$scope.changePage = function (pageName) {
       map.remove();
       $state.go(pageName);
    }
0

There are 0 best solutions below