MOBILE-4015 course: Fix keep scroll when refresh
This commit is contained in:
		
							parent
							
								
									dc6ca1f085
								
							
						
					
					
						commit
						e85acc6868
					
				| @ -1,9 +1,9 @@ | ||||
| <ion-content> | ||||
|     <ion-refresher slot="fixed" [disabled]="!dataLoaded || !displayRefresher" (ionRefresh)="doRefresh($event.target)"> | ||||
|     <ion-refresher slot="fixed" [disabled]="!dataLoaded || updatingData || !displayRefresher" (ionRefresh)="doRefresh($event.target)"> | ||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||
|     </ion-refresher> | ||||
| 
 | ||||
|     <core-loading [hideUntil]="dataLoaded"> | ||||
|     <core-loading [hideUntil]="dataLoaded && !updatingData"> | ||||
|         <core-course-format [course]="course" [sections]="sections" [initialSectionId]="sectionId" [initialSectionNumber]="sectionNumber" | ||||
|             [moduleId]="moduleId" class="core-course-format-{{course.format}}" *ngIf="dataLoaded"> | ||||
|         </core-course-format> | ||||
|  | ||||
| @ -59,6 +59,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon | ||||
|     sectionId?: number; | ||||
|     sectionNumber?: number; | ||||
|     dataLoaded = false; | ||||
|     updatingData = false; | ||||
|     downloadCourseEnabled = false; | ||||
|     moduleId?: number; | ||||
|     displayEnableDownload = false; | ||||
| @ -355,7 +356,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon | ||||
|         const scrollTop = scrollElement?.scrollTop || 0; | ||||
|         const scrollLeft = scrollElement?.scrollLeft || 0; | ||||
| 
 | ||||
|         this.dataLoaded = false; | ||||
|         this.updatingData = true; | ||||
|         this.content?.scrollToTop(0); // Scroll top so the spinner is seen.
 | ||||
| 
 | ||||
|         try { | ||||
| @ -367,7 +368,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon | ||||
| 
 | ||||
|             await this.formatComponent?.doRefresh(undefined, undefined, true); | ||||
|         } finally { | ||||
|             this.dataLoaded = true; | ||||
|             this.updatingData = false; | ||||
| 
 | ||||
|             // Wait for new content height to be calculated and scroll without animation.
 | ||||
|             setTimeout(() => { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user