Search code examples
nativescriptangular2-nativescriptnativescript-angular

Why I can't access native UINavigationBar from ActionBar?


I was trying to access and didn't find the UINavigationBar from an ActionBar, could someone help me there?

TS file

let bar: ActionBar = this.page.getViewById<ActionBar>("bar");
bar.ios.nativeView // undefined
bar.nativeView // undefined

HTML file

<ActionBar id="bar" class="action-bar" title="Recipients"></ActionBar>

Solution

  • Ok I figure out what i've done wrong just putting in Manoj Solution

    HTML:

    <ActionBar id="bar" class="action-bar" title="Recipients" (loaded)="loadActionBar($event)"></ActionBar>
    

    TS:

    loadActionBar($event): void {
       let bar: ActionBar = this.page.getViewById<ActionBar>("bar");
       bar.nativeView // works
    }