File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 1
- import { nativeTimeout } from '../util/dom' ;
1
+ import { nativeTimeout , nativeRaf } from '../util/dom' ;
2
2
import { Platform } from '../platform/platform' ;
3
3
import { ScrollView } from '../util/scroll-view' ;
4
4
@@ -135,7 +135,29 @@ export function setupEvents(platform: Platform): Events {
135
135
let content = < HTMLElement > el . closest ( '.scroll-content' ) ;
136
136
if ( content ) {
137
137
var scroll = new ScrollView ( content ) ;
138
- scroll . scrollTo ( 0 , 0 , 300 ) ;
138
+ // We need to stop scrolling if it's happening and scroll up
139
+
140
+ content . style [ 'WebkitBackfaceVisibility' ] = 'hidden' ;
141
+ content . style [ 'WebkitTransform' ] = 'translate3d(0,0,0)' ;
142
+
143
+ nativeRaf ( function ( ) {
144
+ content . style . overflow = 'hidden' ;
145
+
146
+ function finish ( ) {
147
+ content . style . overflow = '' ;
148
+ content . style [ 'WebkitBackfaceVisibility' ] = '' ;
149
+ content . style [ 'WebkitTransform' ] = '' ;
150
+ }
151
+
152
+ let didScrollTimeout = setTimeout ( ( ) => {
153
+ finish ( ) ;
154
+ } , 400 ) ;
155
+
156
+ scroll . scrollTo ( 0 , 0 , 300 ) . then ( ( ) => {
157
+ clearTimeout ( didScrollTimeout ) ;
158
+ finish ( ) ;
159
+ } ) ;
160
+ } ) ;
139
161
}
140
162
} ) ;
141
163
You can’t perform that action at this time.
0 commit comments