Skip to content

Commit b44c2e3

Browse files
committed
fix: disable broken header collapse on ios
1 parent 48a54af commit b44c2e3

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

src/app/feature/template/template.page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ion-content id="collapseOnScrollTargetScrollArea" [scrollEvents]="shouldEmitScrollEvents">
1+
<ion-content [scrollEvents]="shouldEmitScrollEvents">
22
<plh-template-container
33
*ngIf="templateName"
44
[templatename]="templateName"

src/app/feature/template/template.page.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, OnDestroy, OnInit } from "@angular/core";
22
import { ActivatedRoute } from "@angular/router";
3+
import { Capacitor } from "@capacitor/core";
34
import { FlowTypes, IAppConfig } from "data-models";
45
import { Subscription } from "rxjs";
56
import { AppConfigService } from "src/app/shared/services/app-config/app-config.service";
@@ -45,7 +46,11 @@ export class TemplatePage implements OnInit, OnDestroy {
4546
private subscribeToAppConfigChanges() {
4647
this.appConfigChanges$ = this.appConfigService.changesWithInitialValue$.subscribe(
4748
(changes: IAppConfig) => {
48-
if (changes.APP_HEADER_DEFAULTS?.collapse !== undefined) {
49+
// TODO: current header collapse implementation does not work on ios, so do not enable on this platform
50+
if (
51+
changes.APP_HEADER_DEFAULTS?.collapse !== undefined &&
52+
Capacitor.getPlatform() !== "ios"
53+
) {
4954
this.shouldEmitScrollEvents = changes.APP_HEADER_DEFAULTS?.collapse;
5055
}
5156
}

src/app/shared/components/header/header.component.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,19 @@ export class headerComponent implements OnInit, OnDestroy {
132132
* If disabling dispose of previous scroll event listeners
133133
*/
134134
private handleHeaderCollapseConfigChange(shouldCollapse: boolean) {
135-
// If previously scroll events were subscribed then should be able to unsubscribe.
136-
// If initial config change undefined->false can ignore
137-
if (this.scrollEvents$) {
138-
this.scrollEvents$.unsubscribe();
139-
this.scrollEvents$ = undefined;
140-
this.marginTop = "0px";
141-
// unset height
142-
}
143-
if (shouldCollapse) {
144-
this.listenToScrollEvents();
135+
// TODO: current header collapse implementation does not work on ios, so do not enable on this platform
136+
if (Capacitor.getPlatform() !== "ios") {
137+
// If previously scroll events were subscribed then should be able to unsubscribe.
138+
// If initial config change undefined->false can ignore
139+
if (this.scrollEvents$) {
140+
this.scrollEvents$.unsubscribe();
141+
this.scrollEvents$ = undefined;
142+
this.marginTop = "0px";
143+
// unset height
144+
}
145+
if (shouldCollapse) {
146+
this.listenToScrollEvents();
147+
}
145148
}
146149
}
147150

0 commit comments

Comments
 (0)