mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(scroll): scroll issues in UIWebView
fixes #11081 fixes #10976 fixes #10966 fixes #10936 fixes #11051 fixes #10889
This commit is contained in:
@@ -349,7 +349,7 @@ export class Content extends Ion implements OnDestroy, AfterViewInit {
|
||||
) {
|
||||
super(config, elementRef, renderer, 'content');
|
||||
|
||||
let enableScrollListener = this.enableScrollListener.bind(this);
|
||||
const enableScrollListener = () => this._scroll.enableEvents();
|
||||
this.ionScroll.onSubscribe = enableScrollListener;
|
||||
this.ionScrollStart.onSubscribe = enableScrollListener;
|
||||
this.ionScrollEnd.onSubscribe = enableScrollListener;
|
||||
@@ -359,12 +359,7 @@ export class Content extends Ion implements OnDestroy, AfterViewInit {
|
||||
this._imgRndBfr = config.getNumber('imgRenderBuffer', 400);
|
||||
this._imgVelMax = config.getNumber('imgVelocityMax', 3);
|
||||
|
||||
// use JS scrolling for iOS UIWebView
|
||||
// goal is to completely remove this when iOS
|
||||
// fully supports scroll events
|
||||
// listen to JS scroll events
|
||||
const jsScroll = config.getBoolean('virtualScrollEventAssist');
|
||||
this._scroll = new ScrollView(_app, _plt, _dom, jsScroll);
|
||||
this._scroll = new ScrollView(_app, _plt, _dom);
|
||||
|
||||
while (navCtrl) {
|
||||
if (isTabs(<any>navCtrl)) {
|
||||
@@ -431,8 +426,8 @@ export class Content extends Ion implements OnDestroy, AfterViewInit {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
enableScrollListener() {
|
||||
this._scroll.eventsEnabled = true;
|
||||
enableJsScroll() {
|
||||
this._scroll.enableJsScroll(this._cTop, this._cBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -706,6 +706,14 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
||||
private _listeners() {
|
||||
assert(!this._scrollSub, '_listeners was already called');
|
||||
if (!this._scrollSub) {
|
||||
if (this._config.getBoolean('virtualScrollEventAssist')) {
|
||||
// use JS scrolling for iOS UIWebView
|
||||
// goal is to completely remove this when iOS
|
||||
// fully supports scroll events
|
||||
// listen to JS scroll events
|
||||
this._content.enableJsScroll();
|
||||
}
|
||||
|
||||
this._resizeSub = this._plt.resize.subscribe(this.resize.bind(this));
|
||||
this._scrollSub = this._content.ionScroll.subscribe(this.scrollUpdate.bind(this));
|
||||
this._scrollEndSub = this._content.ionScrollEnd.subscribe(this.scrollEnd.bind(this));
|
||||
|
||||
Reference in New Issue
Block a user