The Wayback Machine - https://web.archive.org/web/20250305093500/https://github.com/NativeScript/NativeScript/issues/7085
Skip to content

layoutChangedEvent does not fire on iOS Page #7085

Closed
@hettiger

Description

Environment

Model OS version Preview app version Runtime version
iPhone X iOS 12.2.0 1.19.0 5.2.0
{
  "@angular/animations": "7.2.4",
  "@angular/common": "7.2.4",
  "@angular/compiler": "7.2.4",
  "@angular/core": "7.2.4",
  "@angular/forms": "7.2.4",
  "@angular/http": "7.2.4",
  "@angular/platform-browser": "7.2.4",
  "@angular/platform-browser-dynamic": "7.2.4",
  "@angular/router": "7.2.4",
  "@progress-nativechat/nativescript-nativechat": "2.0.3",
  "kinvey-nativescript-sdk": "3.12.3",
  "nativescript-accelerometer": "2.0.1",
  "nativescript-angular": "7.2.1",
  "nativescript-background-http": "3.3.1",
  "nativescript-camera": "4.1.1",
  "nativescript-fresco": "5.2.0",
  "nativescript-geolocation": "4.4.2",
  "nativescript-imagepicker": "6.0.6",
  "nativescript-intl": "3.0.0",
  "nativescript-iqkeyboardmanager": "1.4.0",
  "nativescript-social-share": "1.5.1",
  "nativescript-theme-core": "1.0.4",
  "nativescript-ui-autocomplete": "3.11.0",
  "nativescript-ui-calendar": "3.10.0",
  "nativescript-ui-chart": "3.11.1",
  "nativescript-ui-dataform": "3.10.0",
  "nativescript-ui-gauge": "3.8.0",
  "nativescript-ui-listview": "5.1.1",
  "nativescript-ui-sidedrawer": "5.1.0",
  "nativescript-vue": "2.0.2",
  "reflect-metadata": "0.1.13",
  "rxjs": "6.4.0",
  "rxjs-compat": "6.4.0",
  "tns-core-modules": "5.2.0",
  "zone.js": "0.8.29"
}

Describe the bug

The layoutChanged event does not fire on the iOS platform.
On Android the event fires as expected.

To Reproduce

import { Component, OnInit, OnDestroy } from "@angular/core";
import { Page } from "tns-core-modules/ui/page";

@Component({
    selector: "Home",
    moduleId: module.id,
    templateUrl: "./home.component.html",
    styleUrls: ["./home.component.css"]
})
export class HomeComponent implements OnDestroy {

    constructor(private page: Page) {
        page.on(Page.layoutChangedEvent, this.onLayoutChanged, this);
    }

    ngOnDestroy(): void {
        this.page.off(Page.layoutChangedEvent, this.onLayoutChanged, this);
    }

    onLayoutChanged(): void {
        alert('onLayoutChanged fired');
    }
}

Expected behavior

An alert saying »onLayoutChanged fired« should appear when opening the app.

Sample project

https://play.nativescript.org/?template=play-ng&id=Zc20JX


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions