Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(refresher): translate background content when refreshing #20378

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions core/src/components/refresher/refresher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Refresher implements ComponentInterface {
private didStart = false;
private progress = 0;
private scrollEl?: HTMLElement;
private backgroundContentEl?: HTMLElement;
private scrollListenerCallback?: any;
private gesture?: Gesture;

Expand Down Expand Up @@ -394,6 +395,8 @@ export class Refresher implements ComponentInterface {
}

this.scrollEl = await contentEl.getScrollElement();
this.backgroundContentEl = contentEl.shadowRoot!.querySelector('#background-content') as HTMLElement;

if (shouldUseNativeRefresher(this.el, getIonMode(this))) {
this.setupNativeRefresher(contentEl);
} else {
Expand Down Expand Up @@ -652,12 +655,13 @@ export class Refresher implements ComponentInterface {

this.appliedStyles = (y > 0);
writeTask(() => {
if (this.scrollEl) {
const style = this.scrollEl.style;
style.transform = ((y > 0) ? `translateY(${y}px) translateZ(0px)` : 'translateZ(0px)');
style.transitionDuration = duration;
style.transitionDelay = delay;
style.overflow = (overflowVisible ? 'hidden' : '');
if (this.scrollEl && this.backgroundContentEl) {
const scrollStyle = this.scrollEl.style;
const backgroundStyle = this.backgroundContentEl.style;
scrollStyle.transform = backgroundStyle.transform = ((y > 0) ? `translateY(${y}px) translateZ(0px)` : 'translateZ(0px)');
scrollStyle.transitionDuration = backgroundStyle.transitionDuration = duration;
scrollStyle.transitionDelay = backgroundStyle.transitionDelay = delay;
scrollStyle.overflow = (overflowVisible ? 'hidden' : '');
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/themes/ionic.globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $z-index-click-block: 99999;

$z-index-fixed-content: 999;
$z-index-scroll-content: 1;
$z-index-refresher: 0;
$z-index-refresher: -1;

$z-index-page-container: 0;
$z-index-toolbar: 10;
Expand Down