@@ -24,6 +24,7 @@ export class Content implements ComponentInterface {
2424 private cTop = - 1 ;
2525 private cBottom = - 1 ;
2626 private scrollEl ! : HTMLElement ;
27+ private mode = getIonMode ( this ) ;
2728
2829 // Detail is used in a hot loop in the scroll event, by allocating it here
2930 // V8 will be able to inline any read/write to it since it's a monomorphic class.
@@ -102,18 +103,11 @@ export class Content implements ComponentInterface {
102103 */
103104 @Event ( ) ionScrollEnd ! : EventEmitter < ScrollBaseDetail > ;
104105
105- componentWillLoad ( ) {
106- if ( this . forceOverscroll === undefined ) {
107- const mode = getIonMode ( this ) ;
108- this . forceOverscroll = mode === 'ios' && isPlatform ( window , 'mobile' ) ;
109- }
110- }
111-
112106 componentDidLoad ( ) {
113107 this . resize ( ) ;
114108 }
115109
116- componentDidUnload ( ) {
110+ disconnectedCallback ( ) {
117111 this . onScrollEnd ( ) ;
118112 }
119113
@@ -125,6 +119,13 @@ export class Content implements ComponentInterface {
125119 }
126120 }
127121
122+ private shouldForceOverscroll ( ) {
123+ const { forceOverscroll, mode } = this ;
124+ return forceOverscroll === undefined
125+ ? mode === 'ios' && isPlatform ( window , 'mobile' )
126+ : forceOverscroll ;
127+ }
128+
128129 private resize ( ) {
129130 if ( this . fullscreen ) {
130131 readTask ( this . readDimensions . bind ( this ) ) ;
@@ -299,9 +300,9 @@ export class Content implements ComponentInterface {
299300 }
300301
301302 render ( ) {
303+ const { scrollX, scrollY } = this ;
302304 const mode = getIonMode ( this ) ;
303- const { scrollX, scrollY, forceOverscroll } = this ;
304-
305+ const forceOverscroll = this . shouldForceOverscroll ( ) ;
305306 const transitionShadow = ( mode === 'ios' && config . getBoolean ( 'experimentalTransitionShadow' , false ) ) ;
306307
307308 this . resize ( ) ;
@@ -312,7 +313,7 @@ export class Content implements ComponentInterface {
312313 ...createColorClasses ( this . color ) ,
313314 [ mode ] : true ,
314315 'content-sizing' : hostContext ( 'ion-popover' , this . el ) ,
315- 'overscroll' : ! ! this . forceOverscroll ,
316+ 'overscroll' : forceOverscroll ,
316317 } }
317318 style = { {
318319 '--offset-top' : `${ this . cTop } px` ,
@@ -324,7 +325,7 @@ export class Content implements ComponentInterface {
324325 'inner-scroll' : true ,
325326 'scroll-x' : scrollX ,
326327 'scroll-y' : scrollY ,
327- 'overscroll' : ( scrollX || scrollY ) && ! ! forceOverscroll
328+ 'overscroll' : ( scrollX || scrollY ) && forceOverscroll
328329 } }
329330 ref = { el => this . scrollEl = el ! }
330331 onScroll = { ev => this . onScroll ( ev ) }
0 commit comments