What's the purpose of Page.actionBar, ActionBar.actionItems and ActionItem.actionView?


#1

I came across the top example in the ActionBar theming docs. I noticed that Action Items and the content are placed under these extra elements. The view seems to be working the same with (top example) or without them (bottom example), and even Page.actionBar seems to be doing nothing. Are these needed at all? I love throwing unnecessary code out, but I want to check with the experts here.

<Page class="page">
  <Page.actionBar>
    <ActionBar class="action-bar" title="My App">
      <ActionBar.actionItems>
        <ActionItem>
          <ActionItem.actionView>
            <Button text="Action" class="action-item"></Button>
          </ActionItem.actionView>
        </ActionItem>
      </ActionBar.actionItems>
    </ActionBar>
  </Page.actionBar>
</Page>
<Page class="page">
    <ActionBar class="action-bar" title="My App">
        <ActionItem>
            <Button text="Action" class="action-item"></Button>
        </ActionItem>
    </ActionBar>
</Page>

#2

Indeed, I noticed the same thing.

Also, what exactly is the xmlns="http://www.nativescript.org/tns.xsd" doing in some xml pages? It seems to work absolutely fine without this.

:slight_smile:


#3

Excellent tongue-in-cheek comment, my friend. It’s actually http://schemas.nativescript.org/tns.xsd, but anyway this begs two questions:

  1. Why most of the examples in the docs aren’t following the schema?
  2. Why did Telerik design such a verbose schema, where it demands 13 lines of code vs 8 in the examples above.

#4

Oh, sorry, I got this out of some sample page from somewhere, forgot where…

I don’t really know the intricacies of XML (and I’m not really sure I want to know because I hate XML), but what purpose do these “schemas” serve?

That’s why I like JSON: It’s so friggin’ simple. No versions, no verbosity, just clean, clear information.

:slight_smile:


#5

Well, is was www instead of schemas in the past:

https://docs.nativescript.org/releases/breaking-changes#150-2015-november-24

Still don’t see the use tho, hahahaha


#6

Being answered by Hristo Hristov here.