@@ -61,13 +61,14 @@ export default class PageView extends BaseView {
6161 this . _oldPercent = - 1 ;
6262 this . viewport = context . device && context . device . getViewport ? context . device . getViewport ( ) : { width : 0 , height : 0 } ;
6363 this . isActive = false ;
64- this . status = STATUS_NORMAL ;
64+ this . pageStatus = STATUS_NORMAL ;
6565
6666
6767 this . setDefaultsOptions ( {
6868 swipeBack : true ,
6969 animated : true ,
7070 duration : 300 ,
71+ deltaPageRender : 20 ,
7172 viewstack : state ? state . get ( 'viewstack' ) : context . viewstack ,
7273 navigation : state ? state . get ( 'navigation' ) : context . navigation ,
7374 swipeBackDirection : 'horizontal' , // horizontal, vertical, all
@@ -110,21 +111,29 @@ export default class PageView extends BaseView {
110111 // Render
111112 render ( ) {
112113 // If the view is moving delay the render
113- if ( this . status == STATUS_MOVING ) {
114+ if ( this . pageStatus == STATUS_MOVING ) {
114115 if ( this . renderingTimeoutHandler )
115116 clearTimeout ( this . renderingTimeoutHandler ) ;
116117 this . renderingTimeoutHandler = setTimeout ( ( ) => {
117118 this . renderingTimeoutHandler = null ;
118119 this . render ( ) ;
119- } , 300 ) ;
120+ } , this . options . duration ) ;
120121 return ;
121122 }
122123
123- if ( this . options . animated === true ) {
124- this . el . style [ getVendorStyle ( 'transition' ) ] = 'transform ' + this . options . duration + 'ms' ;
124+ if ( this . options . animated === true && ! this . rendered ) {
125125 window . requestNextAnimationFrame ( ( ) => {
126- translate3d ( this . el , 0 , 0 , 0 ) ;
126+ this . el . style [ getVendorStyle ( 'transition' ) ] = 'transform ' + this . options . duration + 'ms' ;
127+ translate3d ( this . el , 0 , 0 , 0 , true ) ;
128+ if ( this . renderingTimeoutHandler )
129+ clearTimeout ( this . renderingTimeoutHandler ) ;
130+ this . renderingTimeoutHandler =
131+ setTimeout ( ( ) => {
132+ this . renderingTimeoutHandler = null ;
133+ return super . render ( ) ;
134+ } , this . options . duration + this . options . deltaPageRender ) ;
127135 } ) ;
136+ return ;
128137 }
129138 return super . render ( ) ;
130139 }
@@ -215,10 +224,12 @@ export default class PageView extends BaseView {
215224 }
216225
217226 onBeforePop ( ) {
218- this . status = STATUS_MOVING ;
227+ this . pageStatus = STATUS_MOVING ;
219228 if ( this . options . animated === true ) {
220- this . el . style [ getVendorStyle ( 'transition' ) ] = 'transform ' + this . options . duration + 'ms' ;
221- translate3d ( this . el , '100%' , 0 , 0 ) ;
229+ window . requestAnimationFrame ( ( ) => {
230+ this . el . style [ getVendorStyle ( 'transition' ) ] = 'transform ' + this . options . duration + 'ms' ;
231+ translate3d ( this . el , '100%' , 0 , 0 ) ;
232+ } ) ;
222233 }
223234 }
224235
@@ -236,7 +247,7 @@ export default class PageView extends BaseView {
236247
237248 if ( isInRect ( pageX , pageY , top , left , width , height ) && this . viewport . width > 0 && ! this . _swipeBackStop ) {
238249
239- this . status = STATUS_MOVING ;
250+ this . pageStatus = STATUS_MOVING ;
240251
241252 document . addEventListener ( 'touchmove' , this . onSwipeBackTouchMove ) ;
242253 document . addEventListener ( 'touchend' , this . onSwipeBackTouchEnd ) ;
@@ -256,7 +267,7 @@ export default class PageView extends BaseView {
256267 onSwipeBackTouchEnd ( ev ) {
257268 if ( ! ev || ! ev . timeStamp || ! this . isActive ) return ;
258269
259- this . status = STATUS_NORMAL ;
270+ this . pageStatus = STATUS_NORMAL ;
260271
261272 let ctx = context ;
262273 let navigation = this . getNavigationView ( ) ;
0 commit comments