Kandy
Kandy

Reputation: 388

wkWebview Navigator Hangs on a simple page on IOS13

Since I updated to IOS13 our App hangs, the page and de Menu don't work, on IOS12 works fine.

I attach a simple code to try, simple press some times for example on zoom in/out and alternate with click on map, and the App hangs.

                Form hi = new Form("form2");

                Toolbar tb = hi.getToolbar();
                Image icon = theme.getImage("icon.png"); 
                Container topBar = BorderLayout.east(new Label(icon));
                topBar.add(BorderLayout.SOUTH, new Label("Cool App Tagline...", "SidemenuTagline")); 
                topBar.setUIID("SideCommand");
                tb.addComponentToSideMenu(topBar);

                tb.addMaterialCommandToSideMenu("Home", FontImage.MATERIAL_HOME, e -> {}); 

                hi.setLayout(new BorderLayout());
                
                BrowserComponent browserComponent = new BrowserComponent();
                browserComponent.setURL("https://leafletjs.com/examples/quick-start/example.html");

                hi.add(BorderLayout.CENTER, browserComponent);
                hi.show();

Upvotes: 2

Views: 160

Answers (1)

Kandy
Kandy

Reputation: 388

The problem was in the leaflet.js, in this commit https://github.com/Leaflet/Leaflet/pull/6855/files/862d3f600ce0f40795149a32bf980ff6000bf132 makes the library 1.6.0 hangs on codenameOne and IOS13.

The solution for me, was use the oficial 1.5.1 library (http://cdn.leafletjs.com/leaflet/v1.5.1/leaflet.zip) and make a function to emulate an doubleclick, based on this post: leaflet: don't fire click event function on doubleclick

This is part of code:

        // Create a Global variable
        var clicked = 0;

        //on map declaration disable tap and doubleClickZomm
        mapid = new L.map("mapid",{ attributionControl: false, zoomControl: false, doubleClickZoom: false, tap : false});

        // Map click event                  
        mapid.on('click', function(e) {
            // Calling the new function
            controlClick(); 
        });
                
        // Map DoubleClick event                    
        mapid.on('dblclick', function(e) {
            // Calling the new function
            controlClick();    
        });

        /*
        *  Declare an Emmulated doubleClickZoom function
        */
        function controlClick(){
            clicked = clicked +1;
            setTimeout(function(){
                if(clicked > 0){
                    clicked = 0;
                }
             }, 500);
            if (clicked > 1 ){
                mapid.zoomIn();
                clicked = 0;
            } 
        }

Upvotes: 1

Related Questions