-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(content): check for scroll element before modifying it (#10374)
* test(refresher): add nav based refresher e2e test * test(refresher): tweak test to repro issue * fix(content): check for scroll element * chore(content): double check for a scroll element
- Loading branch information
1 parent
f47d492
commit 6a0c92c
Showing
4 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import { Component, NgModule } from '@angular/core'; | ||
import { IonicApp, IonicModule, Refresher, NavController } from '../../../../../ionic-angular'; | ||
|
||
|
||
@Component({ | ||
templateUrl: 'main.html' | ||
}) | ||
export class Page1 { | ||
items: string[] = []; | ||
|
||
constructor(public nav: NavController) { | ||
for (var i = 0; i < 15; i++) { | ||
this.items.push( getRandomData() ); | ||
} | ||
} | ||
|
||
doRefresh(refresher: Refresher) { | ||
console.info('Begin async operation'); | ||
|
||
getAsyncData().then((newData: string[]) => { | ||
for (var i = 0; i < newData.length; i++) { | ||
this.items.unshift( newData[i] ); | ||
} | ||
|
||
console.info('Finished receiving data, async operation complete'); | ||
refresher.complete(); | ||
}); | ||
} | ||
|
||
doStart(refresher: Refresher) { | ||
console.info('Refresher, start'); | ||
} | ||
|
||
doPulling(refresher: Refresher) { | ||
console.info('Pulling', refresher.progress); | ||
} | ||
|
||
navigate() { | ||
this.nav.setRoot(Page2); | ||
} | ||
|
||
} | ||
|
||
function getAsyncData() { | ||
// async return mock data | ||
return new Promise(resolve => { | ||
|
||
setTimeout(() => { | ||
let data: string[] = []; | ||
for (var i = 0; i < 3; i++) { | ||
data.push( getRandomData() ); | ||
} | ||
|
||
resolve(data); | ||
}, 3000); | ||
|
||
}); | ||
} | ||
|
||
function getRandomData() { | ||
let i = Math.floor( Math.random() * data.length ); | ||
return data[i]; | ||
} | ||
|
||
const data = [ | ||
'Fast Times at Ridgemont High', | ||
'Peggy Sue Got Married', | ||
'Raising Arizona', | ||
'Moonstruck', | ||
'Fire Birds', | ||
'Honeymoon in Vegas', | ||
'Amos & Andrew', | ||
'It Could Happen to You', | ||
'Trapped in Paradise', | ||
'Leaving Las Vegas', | ||
'The Rock', | ||
'Con Air', | ||
'Face/Off', | ||
'City of Angels', | ||
'Gone in Sixty Seconds', | ||
'The Family Man', | ||
'Windtalkers', | ||
'Matchstick Men', | ||
'National Treasure', | ||
'Ghost Rider', | ||
'Grindhouse', | ||
'Next', | ||
'Kick-Ass', | ||
'Drive Angry' | ||
]; | ||
|
||
@Component({ | ||
templateUrl: 'page2.html' | ||
}) | ||
export class Page2 { | ||
constructor() {} | ||
} | ||
|
||
@Component({ | ||
template: '<ion-nav [root]="rootPage"></ion-nav>' | ||
}) | ||
export class E2EApp { | ||
rootPage = Page1; | ||
} | ||
|
||
@NgModule({ | ||
declarations: [ | ||
E2EApp, | ||
Page1, | ||
Page2 | ||
], | ||
imports: [ | ||
IonicModule.forRoot(E2EApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
E2EApp, | ||
Page1, | ||
Page2 | ||
] | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<ion-header> | ||
|
||
<ion-toolbar> | ||
<ion-title>Pull To Refresh Navigation</ion-title> | ||
</ion-toolbar> | ||
|
||
</ion-header> | ||
|
||
|
||
<ion-content padding> | ||
|
||
<ion-refresher (ionStart)="doStart($event)" (ionPull)="doPulling($event)" (ionRefresh)="doRefresh($event)"> | ||
|
||
<ion-refresher-content | ||
pullingText="Pull to refresh..." | ||
refreshingSpinner="bubbles" | ||
refreshingText="Refreshing..."> | ||
</ion-refresher-content> | ||
|
||
</ion-refresher> | ||
|
||
<h1>Pull to refresh and then navigate with the button below</h1> | ||
|
||
<button ion-button (click)="navigate()">navigate</button> | ||
|
||
<ion-list> | ||
<ion-item *ngFor="let item of items"> | ||
{{ item }} | ||
</ion-item> | ||
</ion-list> | ||
|
||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<ion-header> | ||
|
||
<ion-toolbar> | ||
<ion-title>Pull To Refresh Navigation</ion-title> | ||
</ion-toolbar> | ||
|
||
</ion-header> | ||
|
||
|
||
<ion-content padding> | ||
|
||
<h1>Page Two</h1> | ||
|
||
</ion-content> |