Skip to content

Visibility attribute on ActionItem element #691

@Kamilius

Description

@Kamilius

Hi guys. I didn't found any documentation on how 'visibility' actually works and for which elements. Only related article I've found is http://tjvantoll.com/2015/06/05/nativescript-showing-and-hiding-elements/ .

Now I'm struggling with following visibility manipulation:

  <Page.actionBar>
    <ActionBar title="SampleApp">
      <ActionBar.actionItems>
        <ActionItem text="Stop"
                    tap="stopTimer" ios.position="right"
                    visibility="{{ timerId === 0 ? 'collapse' : 'visible' }}"/>
        <ActionItem text="Resume"
                    tap="startTimer" ios.position="right"
                    visibility="{{ timerId === 0 ? 'visible' : 'collapse' }}"/>
        <ActionItem text="Save"
                    tap="saveEntryToEntriesFile" ios.position="right"
                    visibility="{{ timerId === 0 ? 'visible' : 'collapse' }}"/>
      </ActionBar.actionItems>
    </ActionBar>
  </Page.actionBar>

timerId, is a set property of pageData observable, which holds page context.
First ActionItem should be seen only when timerId is different from 0 and second+third buttons, when timerId is 0.

But currently all ActionItem elements are always visible, no matter timerId is 0 or holds value different from it.

Would be awesome to have a separate documentation chapter describing how to show/hide elements from both xml markup and code, as well as which elements could be dynamically shown/hidden and which are not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions