Cordova-plugin-ionic-webview: iOS 12.2 scroll hangs

Created on 4 Mar 2019  路  62Comments  路  Source: ionic-team/cordova-plugin-ionic-webview

Our app seems to have the scrolling hang on certain pages. In the CDVWKWebViewEngine.m file on the (void)handleStopScroll method when I change the last line from -

a) [wkWebView evaluateJavaScript:@"window.IonicStopScroll.fire()" completionHandler:nil];

To -

b) [wkWebView evaluateJavaScript:@"window.IonicStopScroll.cancel()" completionHandler:nil];

The scrolling then seems to work. I'm not sure if there is an issue with this section in the wk-plugin.js file -

 var stopScrollFunc = null;
  var stopScroll = {
    stop: function stop(callback) {
      if (!stopScrollFunc) {
        stopScrollFunc = callback;
        stopScrollHandler.postMessage('');
      }
    },
    fire: function fire() {
      stopScrollFunc && stopScrollFunc();
      stopScrollFunc = null;
    },
    cancel: function cancel() {
      stopScrollFunc = null;
    }
  };

  window.Ionic.StopScroll = stopScroll;
  // deprecated
  window.IonicStopScroll = stopScroll;

Most helpful comment

This totally solves it for me. Add this to your scss:

ion-app.platform-ios12 ion-content { pointer-events: auto; /*fix scroll lock on ios12.2*/ }

All 62 comments

@BumbleeLin - do you happen to have reproduction steps & a sample application that exhibits the issue?

I'm working with someone on a similar issue, but haven't yet experienced this issue myself. If you have the chance to write up a simple demo app and post that here, that'd be great!

Edit: Additionally, if you can post more information about your app environment (post the outputs of ionic info and cordova plugin ls), that'd be great.

@Baadier-Sydow you're also welcome to post a sample application if this is an issue for you :) we're trying to look into it but have no viable reproduction steps / sample app at the moment.

@bryplano awesome. I will try to help with a sample app. See below the Ionic info:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 6.2.2 ios 4.5.5
Ionic Framework    : ionic-angular 3.6.0

System:

ios-deploy : 1.9.4
Node       : v8.11.4
npm        : 6.4.1
OS         : macOS
Xcode      : Xcode 9.4.1 Build version 9F2000

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

---------------------------->

Below is the plugin list :

com-sarriaroman-photoviewer 1.1.10 "PhotoViewer"
cordova-plugin-actionsheet 2.3.1 "ActionSheet"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-fcm 2.1.2 "FCMPlugin"
cordova-plugin-geolocation 2.4.1 "Geolocation"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-ionic-webview 4.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-velda-devicefeedback 0.0.2 "DeviceFeedback"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic 3.6.5 "Diagnostic"
ionic-plugin-keyboard 2.2.1 "Keyboard"
uk.co.workingedge.phonegap.plugin.launchnavigator 3.2.1 "Launch Navigator"

I will continue to dig deeper into this issue and let you know if I have any updates.

@BumbleeLin awesome! Thank you so much :) we're working on it from our end as well, so we'll be sure to update if we find anything.

Here is a sample app that shows the behavior: https://github.com/kensodemann/test-scroll

Run on a phone that is running iOS 12.2 Beta 4

On home, press the button, which opens a child that will not scroll.
Make the change that @BumbleeLin specifies in the original post and rebuild
Now the scroll works when the child page is navigated to

@bryplano I'm on the same team as @BumbleeLin

Unfortunately the project is too large for us to create something reproducible as we arent sure on the root cause. It seems like @kensodemann may have something that can help.

@kensodemann @bryplano What @BumbleeLin didnt mention is that even after that change we have one or two screens that still dont work. We are going to see if we can find the root cause but arent really making any headway.

@Baadier-Sydow no problem! Thanks for clarifying and thanks to @kensodemann for the demo app.

We're taking a look at this on our end and will post once we have any update.

I wrote up a separate issue for the Ionic v3 repo: https://github.com/ionic-team/ionic-v3/issues/984

Probably best to follow both issues as last I checked, the team is working on determining where a fix would come from. Suspicion is a Webkit / Safari issue but still working it out :)

I'm going to add another issue that was up by one our testers both here and on the v3 repo as it could be linked. We have a feature that opens an external site in an inappbrowser and then returns back to the application.

We started with the Ionic side menu starter and according to the testers the menu intermittently stops responding to the press to open it ie the menu does not slide open when we get focus back from the inappbrowser.

This was working prior to iOS 12.2.

I think it has been fixed on 12.2 beta 6

@BumbleeLin - I have closed my issue on the v3 repo because the problem no longer exists after installing iOS 12.2 Beta 6 (released earlier this week).

Reference: https://github.com/ionic-team/ionic-v3/issues/984

Could you check and see if you still have issues?

Thanks @bryplano @BumbleeLin and I will have a look 馃憤

@bryplano cool bro, will give you feedback on this

@bryplano yo man, I'm still not having any luck with the scroll issue. Do you perhaps have any other suggestions? I have updated the device to iOS 12.2 beta 6 and used XCode 10.2 beta 4.

@BumbleeLin - I'd recommend updating to the iOS 12.2 GA release and Xcode 10.2 GA release as well.

Do you have a simple sample application that exhibits this behavior? Beyond that, does the scroll issue occur with _and_ without cordova-plugin-ionic-webview installed?

Apple has made some changes to Webkit as part of this 12.2 release (which we found out was causing the scrolling issue I mentioned in my previous post), so it could be there are other weird issues there too.

@bryplano thanks. I'm busy with the update at the moment. I will let you know once I have done this. Thanks!

Did you solve this issue?
I'm getting the exact same behavior as described in ionic-team/ionic-v3#984.

I tried updating/upgrading several packages with no luck so far...

@phpfs we still havent been able to test. @BumbleeLin and I are having issues with the latest update to Xcode. But, we'll update here as soon as we know more.

I'm experiencing this issue as well on the simulator and device. I'm using Ionic v3 and XCode 10.2.

Do you have a simple sample application that exhibits this behavior? Beyond that, does the scroll issue occur with _and_ without cordova-plugin-ionic-webview installed?

Apple has made some changes to Webkit as part of this 12.2 release (which we found out was causing the scrolling issue I mentioned in my previous post), so it could be there are other weird issues there too.

@daviddickson, have you seen if this occurs _without_ the webview plugin installed (per my previous comment)? It would be worth trying to reproduce the problem in a simple sample application - like I said, with the Webkit changes in 12.2, I wouldn't be surprised if this is actually a Webkit bug, but it could be an issue with ionic-webview too... would like to try and determine that :)

@bryplano Thank you for the quick response. I appreciate it. I just created a sample app with the webview plugin installed and with the html where I'm experiencing the issue but I'm not able to reproduce it in the sample app.

@daviddickson can you show your plugin list?

In the sample app:

    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />

In the app where I'm experiencing the issue:

    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^2.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-sqlite-storage" spec="2.5.2" />
    <plugin name="cordova-plugin-network-information" spec="2.0.1" />
    <plugin name="cordova-plugin-app-version" spec="0.1.9" />

Maybe bump you webview plugin to sample app version?

I removed it using ionic cordova plugin remove and re-added. It added at version 4.0.1. Still experiencing the issue.

@daviddickson kak me too. No luck with Xcode 10.2.

I tried installing @3 which installed 3.1.2 and tried installing specifically 3.0.0. Neither worked.

@BumbleeLin I can confirm the fix you put in the initial post works for me.

@daviddickson awesome! Just test all pages, we have one page that doesn't scroll with the initial post fix the rest of the pages scroll fine.

There seems to be a fix for said issue on the v3 repo - did this help anyone? :)
https://github.com/ionic-team/ionic-v3/pull/989

@BumbleeLin Works for me on all pages that have scrolling.

@phpfs How do you update to that version?

@daviddickson Do a backup, then remove ionic-angular. Finally, npm install ionic3 via the git repo :)

@bryplano yo man :) what is the purpose of the handleStopScroll method? If we remove it will the app break in any unexpected way?

@phpfs is the fix a work around for now?

@daviddickson this fix works - ionic-team/ionic-v3#989

@phpfs

Currently the app I'm working on is at the finish line for a MVP and I'm hesitant to make environment/Ionic CLI changes because I'm not comfortable with the inner workings of what's going on here.

That being said would a step by step walkthrough of what you said look like this? -

  1. Backup - as in make a copy of the folder?
  2. npm uninstall ionic-angular (from within the project)
  3. npm install ionic-angular (at a specific version?)
  4. npm uninstall -g ionic
  5. npm install -g ionic@3

@daviddickson
EDIT: Didn't work for me...

@daviddickson Did you have any luck?

@phpfs I haven't tried. I'm going to hold off.

@daviddickson , the fix should be within ionic-angular nightly build 3.9.4-201903121725 as far as I know

@daviddickson if the initial fix works for you then I think you should be safe. I also don't think that you need to update your version of Ionic to get the fix, you can manually apply the code that fixes it from the Ionic V3 repo. If you want to take the latter approach then let me know I can help you with that :)

@BumbleeLin I'm just going to stick with the initial fix for now. Thanks for offering to help. :)

Does anyone know how to fix this if I use this plugin inside a ionic-less cordova app ? I'm open to any kind of solution.

@simlevesque please see first comment in issue

I have the same issue. Any solution or workaround for this problem?

See my comment above: If you use ionic, follow https://github.com/ionic-team/ionic-v3/issues/984#issuecomment-479395735 :)

i've installed this specific version of ionic npm i [email protected]
but doesn't work

After updating try to rebuild your project or platforms

Ok i will try and I'll let you know.
Thank You!

I've tried with rebuild and re-added platform but doesn't work. :|
If is in page there is an event the scroll it work otherwise doesnt' work.

Any solution?

@filippodicostanzo Okay try below, if it doesn't work then you are more than welcomed to contact me directly :

In Xcode > Plugins/CDVWKWebViewEngine.m file on the (void)handleStopScroll method change the last line from -

a) [wkWebView evaluateJavaScript:@"window.IonicStopScroll.fire()" completionHandler:nil];

To -

b) [wkWebView evaluateJavaScript:@"window.IonicStopScroll.cancel()" completionHandler:nil];

@BumbleeLin yes I tried this too but it doesn't work.

How to contact directly?

The testing is very fast.
Just start a new blank project of ionic v3 with sidemenu options

ionic cordova add platform ios
ionic cordova build ios

just run on a real device and if you change the page from menu the scroll of page doesnt' work.

I repeat the problem only occurs on devices with iOS 12.2

This totally solves it for me. Add this to your scss:

ion-app.platform-ios12 ion-content { pointer-events: auto; /*fix scroll lock on ios12.2*/ }

This totally solves it for me. Add this to your scss:

ion-app.platform-ios12 ion-content { pointer-events: auto; /*fix scroll lock on ios12.2*/ }

Confirmed as working for me! Really appreciate it.

This totally solves it for me. Add this to your scss:

ion-app.platform-ios12 ion-content { pointer-events: auto; /*fix scroll lock on ios12.2*/ }

This works great, but I'm having the same issue on action sheets and adding the same css to .action-sheet-group doesn't help

FYI I had an issue on Ionic3 with webview and i removed these dependencies and the issue was fixed:

"@ionic-native/ionic-webview": "^5.0.0",
"cordova-plugin-ionic-webview": "^4.0.0",

I have similar issue. Scroll works but keep sticky in ios 12.2

https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/495

This works for me. i.e ion-scroll

<ion-content>

  <ion-scroll scrollY="true">
  <ion-list>


  </ion-list>
</ion-scroll>
</ion-content>

.css

  ion-scroll {
        white-space: nowrap;
        height: 700px;
    }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

slymeng picture slymeng  路  5Comments

odecharette picture odecharette  路  4Comments

lincolnthree picture lincolnthree  路  7Comments

50l3r picture 50l3r  路  7Comments

jamesdixon picture jamesdixon  路  4Comments