Skip to content

Commit

Permalink
feat(angular): use large titles on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker authored May 26, 2024
1 parent f7c6783 commit bc2a8ea
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions apps/nativescript-starter-angular/src/app/item/items.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { Component, OnInit, inject } from '@angular/core'
import { Page } from '@nativescript/core'

import { Item } from './item'
import { ItemService } from './item.service'
Expand All @@ -8,9 +9,20 @@ import { ItemService } from './item.service'
templateUrl: './items.component.html',
})
export class ItemsComponent implements OnInit {
items: Array<Item>
page = inject(Page);
itemService = inject(ItemService);
items: Array<Item>;

constructor(private itemService: ItemService) {}
constructor() {
// Setup large titles on iOS
this.page.on('loaded', (args) => {
if (__IOS__) {
const navigationController: UINavigationController =
this.page.frame.ios.controller;
navigationController.navigationBar.prefersLargeTitles = true;
}
});
}

ngOnInit(): void {
this.items = this.itemService.getItems()
Expand Down

0 comments on commit bc2a8ea

Please sign in to comment.