diff --git a/ionic/components/scroll/pull-to-refresh.scss b/ionic/components/scroll/pull-to-refresh.scss index c593cb6cf0..c97342b22f 100644 --- a/ionic/components/scroll/pull-to-refresh.scss +++ b/ionic/components/scroll/pull-to-refresh.scss @@ -1,3 +1,4 @@ +// Scroll refresher (for pull to refresh) ion-refresher { position: absolute; top: -60px; @@ -6,12 +7,12 @@ ion-refresher { overflow: hidden; margin: auto; height: 60px; - .refresher { + .refresher-content { position: absolute; bottom: 15px; left: 0; width: 100%; - color: #fff; + color: #000;//$scroll-refresh-icon-color; text-align: center; font-size: 30px; @@ -21,8 +22,83 @@ ion-refresher { font-size: 16px; line-height: 16px; } - &.ionic-refresher-with-text { + &.refresher-with-text { bottom: 10px; } } + + .icon-refreshing, + .icon-pulling { + width: 100%; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + } + .icon-pulling { + animation-name: refresh-spin-back; + animation-duration: 200ms; + animation-timing-function: linear; + animation-fill-mode: none; + transform: translate3d(0,0,0) rotate(0deg); + } + .icon-refreshing, + .text-refreshing { + display: none; + } + .icon-refreshing { + animation-duration: 1.5s; + } + + &.active { + .icon-pulling:not(.pulling-rotation-disabled) { + animation-name: refresh-spin; + transform: translate3d(0,0,0) rotate(-180deg); + } + &.refreshing { + transition: -webkit-transform .2s; + transition: transform .2s; + transform: scale(1,1); + + .icon-pulling, + .text-pulling { + display: none; + } + .icon-refreshing, + .text-refreshing { + display: block; + } + &.refreshing-tail { + transform: scale(0,0); + } + } + } +} +.scroll-content.overscroll{ + position:fixed; +} +/* + -webkit-overflow-scrolling:touch; + width:100%; +} +*/ + +@-webkit-keyframes refresh-spin { + 0% { -webkit-transform: translate3d(0,0,0) rotate(0); } + 100% { -webkit-transform: translate3d(0,0,0) rotate(180deg); } +} + +@keyframes refresh-spin { + 0% { transform: translate3d(0,0,0) rotate(0); } + 100% { transform: translate3d(0,0,0) rotate(180deg); } +} + +@-webkit-keyframes refresh-spin-back { + 0% { -webkit-transform: translate3d(0,0,0) rotate(180deg); } + 100% { -webkit-transform: translate3d(0,0,0) rotate(0); } +} + +@keyframes refresh-spin-back { + 0% { transform: translate3d(0,0,0) rotate(180deg); } + 100% { transform: translate3d(0,0,0) rotate(0); } } diff --git a/ionic/components/scroll/pull-to-refresh.ts b/ionic/components/scroll/pull-to-refresh.ts index d05f604c50..fbf5c0d1a0 100644 --- a/ionic/components/scroll/pull-to-refresh.ts +++ b/ionic/components/scroll/pull-to-refresh.ts @@ -1,15 +1,40 @@ -import {Component, View, ElementRef, EventEmitter, Parent} from 'angular2/angular2' +import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Parent} from 'angular2/angular2' import {Content} from '../content/content'; -import {raf, ready, CSS} from 'ionic/util/dom' +import * as util from 'ionic/util'; +import {raf, ready, CSS} from 'ionic/util/dom'; @Component({ selector: 'ion-refresher', - events: ['refresh', 'pulling'] + events: ['refresh', 'starting', 'pulling'], + properties: [ + 'pullingIcon', + 'pullingText', + 'refreshingIcon', + 'refreshingText', + 'spinner', + 'disablePullingRotation' + ], + host: { + '[class.active]': 'isActive', + '[class.refreshing]': 'isRefreshing', + '[class.refreshingTail]': 'isRefreshingTail' + } }) @View({ - template: '
', + template: `