mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(refresher): adds threshold
This commit is contained in:
@ -26,7 +26,6 @@ export class Refresher {
|
|||||||
|
|
||||||
private appliedStyles = false;
|
private appliedStyles = false;
|
||||||
private didStart = false;
|
private didStart = false;
|
||||||
private gestureConfig: any;
|
|
||||||
private progress = 0;
|
private progress = 0;
|
||||||
private scrollEl: HTMLElement | null = null;
|
private scrollEl: HTMLElement | null = null;
|
||||||
|
|
||||||
@ -94,22 +93,6 @@ export class Refresher {
|
|||||||
*/
|
*/
|
||||||
@Event() ionStart!: EventEmitter<void>;
|
@Event() ionStart!: EventEmitter<void>;
|
||||||
|
|
||||||
componentWillLoad() {
|
|
||||||
this.gestureConfig = {
|
|
||||||
'canStart': this.canStart.bind(this),
|
|
||||||
'onStart': this.onStart.bind(this),
|
|
||||||
'onMove': this.onMove.bind(this),
|
|
||||||
'onEnd': this.onEnd.bind(this),
|
|
||||||
'gestureName': 'refresher',
|
|
||||||
'gesturePriority': 10,
|
|
||||||
'type': 'pan',
|
|
||||||
'passive': false,
|
|
||||||
'direction': 'y',
|
|
||||||
'threshold': 0,
|
|
||||||
'attachTo': this.el.closest('ion-content')
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidLoad() {
|
componentDidLoad() {
|
||||||
if (this.el.getAttribute('slot') !== 'fixed') {
|
if (this.el.getAttribute('slot') !== 'fixed') {
|
||||||
console.error('Make sure you use: <ion-refresher slot="fixed">');
|
console.error('Make sure you use: <ion-refresher slot="fixed">');
|
||||||
@ -241,6 +224,7 @@ export class Refresher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prevent native scroll events
|
// prevent native scroll events
|
||||||
|
console.log('preventDefault');
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
// the refresher is actively pulling at this point
|
// the refresher is actively pulling at this point
|
||||||
@ -360,7 +344,17 @@ export class Refresher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <ion-gesture {...this.gestureConfig}
|
return <ion-gesture
|
||||||
|
canStart={this.canStart.bind(this)}
|
||||||
|
onStart={this.onStart.bind(this)}
|
||||||
|
onMove={this.onMove.bind(this)}
|
||||||
|
onEnd={this.onEnd.bind(this)}
|
||||||
|
gestureName="refresher"
|
||||||
|
gesturePriority={10}
|
||||||
|
passive={false}
|
||||||
|
direction="y"
|
||||||
|
threshold={5}
|
||||||
|
attachTo={this.el.closest('ion-content') as any}
|
||||||
disabled={this.disabled}>
|
disabled={this.disabled}>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</ion-gesture>;
|
</ion-gesture>;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
function render() {
|
function render() {
|
||||||
let html = '';
|
let html = '';
|
||||||
for(let item of items) {
|
for(let item of items) {
|
||||||
html += `<ion-item>${item}</ion-item>`;
|
html += `<ion-item button>${item}</ion-item>`;
|
||||||
}
|
}
|
||||||
list.innerHTML = html;
|
list.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user