@@ -10,7 +10,7 @@ import {
1010 ION_CONTENT_ELEMENT_SELECTOR ,
1111 printIonContentErrorMsg ,
1212} from '../../utils/content' ;
13- import { clamp , getElementRoot , raf , transitionEndAsync } from '../../utils/helpers' ;
13+ import { clamp , componentOnReady , getElementRoot , raf , transitionEndAsync } from '../../utils/helpers' ;
1414import { hapticImpact } from '../../utils/native/haptic' ;
1515
1616import {
@@ -452,38 +452,39 @@ export class Refresher implements ComponentInterface {
452452 * Waits for the content to be ready before querying the scroll
453453 * or the background content element.
454454 */
455- await contentEl . componentOnReady ( ) ;
456- const customScrollTarget = contentEl . querySelector ( ION_CONTENT_CLASS_SELECTOR ) ;
457- /**
458- * Query the custom scroll target (if available), first. In refresher implementations,
459- * the ion-refresher element will always be a direct child of ion-content (slot="fixed"). By
460- * querying the custom scroll target first and falling back to the ion-content element,
461- * the correct scroll element will be returned by the implementation.
462- */
463- this . scrollEl = await getScrollElement ( customScrollTarget ?? contentEl ) ;
464- /**
465- * Query the background content element from the host ion-content element directly.
466- */
467- this . backgroundContentEl = await contentEl . getBackgroundElement ( ) ;
468-
469- if ( await shouldUseNativeRefresher ( this . el , getIonMode ( this ) ) ) {
470- this . setupNativeRefresher ( contentEl ) ;
471- } else {
472- this . gesture = ( await import ( '../../utils/gesture' ) ) . createGesture ( {
473- el : contentEl ,
474- gestureName : 'refresher' ,
475- gesturePriority : 31 ,
476- direction : 'y' ,
477- threshold : 20 ,
478- passive : false ,
479- canStart : ( ) => this . canStart ( ) ,
480- onStart : ( ) => this . onStart ( ) ,
481- onMove : ( ev ) => this . onMove ( ev ) ,
482- onEnd : ( ) => this . onEnd ( ) ,
483- } ) ;
455+ componentOnReady ( contentEl , async ( ) => {
456+ const customScrollTarget = contentEl . querySelector ( ION_CONTENT_CLASS_SELECTOR ) ;
457+ /**
458+ * Query the custom scroll target (if available), first. In refresher implementations,
459+ * the ion-refresher element will always be a direct child of ion-content (slot="fixed"). By
460+ * querying the custom scroll target first and falling back to the ion-content element,
461+ * the correct scroll element will be returned by the implementation.
462+ */
463+ this . scrollEl = await getScrollElement ( customScrollTarget ?? contentEl ) ;
464+ /**
465+ * Query the background content element from the host ion-content element directly.
466+ */
467+ this . backgroundContentEl = await contentEl . getBackgroundElement ( ) ;
468+
469+ if ( await shouldUseNativeRefresher ( this . el , getIonMode ( this ) ) ) {
470+ this . setupNativeRefresher ( contentEl ) ;
471+ } else {
472+ this . gesture = ( await import ( '../../utils/gesture' ) ) . createGesture ( {
473+ el : contentEl ,
474+ gestureName : 'refresher' ,
475+ gesturePriority : 31 ,
476+ direction : 'y' ,
477+ threshold : 20 ,
478+ passive : false ,
479+ canStart : ( ) => this . canStart ( ) ,
480+ onStart : ( ) => this . onStart ( ) ,
481+ onMove : ( ev ) => this . onMove ( ev ) ,
482+ onEnd : ( ) => this . onEnd ( ) ,
483+ } ) ;
484484
485- this . disabledChanged ( ) ;
486- }
485+ this . disabledChanged ( ) ;
486+ }
487+ } ) ;
487488 }
488489
489490 disconnectedCallback ( ) {
0 commit comments