Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Frame

Represents the logical View unit that is responsible for navigation withing an application. Typically an application will have a Frame object at a root level. Nested frames are supported, enabling hierarchical navigation scenarios.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • Please note that should you be using the new Observable({}) constructor, it is obsolete since v3.0, and you have to migrate to the "data/observable" fromObject({}) or the fromObjectRecursive({}) functions.

    Returns Frame

Properties

_context

_context: any

_cssState

_cssState: any

Private _currentHeightMeasureSpec

_currentHeightMeasureSpec: number

Private _currentWidthMeasureSpec

_currentWidthMeasureSpec: number

Private _defaultPaddingBottom

_defaultPaddingBottom: number

Private _defaultPaddingLeft

_defaultPaddingLeft: number

Private _defaultPaddingRight

_defaultPaddingRight: number

Private _defaultPaddingTop

_defaultPaddingTop: number

_domId

_domId: number

Private _gestureObservers

_gestureObservers: any

_isAddedToNativeVisualTree

_isAddedToNativeVisualTree: boolean

Optional Private _isBack

_isBack: boolean

Private _isPaddingRelative

_isPaddingRelative: boolean

Private _isViewBase

_isViewBase: boolean

Filed to use instead of instanceof ViewBase.

Private _oldBottom

_oldBottom: number

Private _oldLeft

_oldLeft: number

Private _oldRight

_oldRight: number

Private _oldTop

_oldTop: number

_styleScope

_styleScope: any

_suspendNativeUpdatesCount

_suspendNativeUpdatesCount: number

Determines the depth of suspended updates. When the value is 0 the current property updates are not batched nor scoped and must be immediately applied. If the value is 1 or greater, the current updates are batched and does not have to provide immediate update. Do not set this field, the _batchUpdate method is responsible to keep the count up to date, as well as adding/rmoving the view to/from the visual tree.

Private _suspendedUpdates

_suspendedUpdates: object

A property bag holding suspended native updates. Native setters that had to execute while there was no native view, or the view was detached from the visual tree etc. will accumulate in this object, and will be applied when all prerequisites are met.

Type declaration

alignSelf

alignSelf: AlignSelf

android

android: AndroidFrame

Gets the AndroidFrame object that represents the Android-specific APIs for this Frame. Valid when running on Android OS.

animated

animated: boolean

Gets or sets if navigation transitions should be animated.

automationText

automationText: string

Gets or sets the automation text of the view.

backStack

backStack: Array<BackstackEntry>

Gets the back stack of this instance.

background

background: string

Gets or sets the background style property.

backgroundColor

backgroundColor: string | Color

Gets or sets the background color of the view.

backgroundImage

backgroundImage: string

Gets or sets the background image of the view.

bindingContext

bindingContext: any

Gets or sets the binding context of this instance. This object is used as a source for each Binding that does not have a source object specified.

borderBottomColor

borderBottomColor: Color

Gets or sets the bottom border color of the view.

borderBottomLeftRadius

borderBottomLeftRadius: Length

Gets or sets the bottom left border radius of the view.

borderBottomRightRadius

borderBottomRightRadius: Length

Gets or sets the bottom right border radius of the view.

borderBottomWidth

borderBottomWidth: Length

Gets or sets the bottom border width of the view.

borderColor

borderColor: string | Color

Gets or sets the border color of the view.

borderLeftColor

borderLeftColor: Color

Gets or sets the left border color of the view.

borderLeftWidth

borderLeftWidth: Length

Gets or sets the left border width of the view.

borderRadius

borderRadius: string | Length

Gets or sets the border radius of the view.

borderRightColor

borderRightColor: Color

Gets or sets the right border color of the view.

borderRightWidth

borderRightWidth: Length

Gets or sets the right border width of the view.

borderTopColor

borderTopColor: Color

Gets or sets the top border color of the view.

borderTopLeftRadius

borderTopLeftRadius: Length

Gets or sets the top left border radius of the view.

borderTopRightRadius

borderTopRightRadius: Length

Gets or sets the top right border radius of the view.

borderTopWidth

borderTopWidth: Length

Gets or sets the top border width of the view.

borderWidth

borderWidth: string | Length

Gets or sets the border width of the view.

className

className: string

Gets or sets the CSS class name for this view.

col

col: number

colSpan

colSpan: number

color

color: Color

Gets or sets the color of the view.

cssClasses

cssClasses: Set<string>

cssPseudoClasses

cssPseudoClasses: Set<string>

cssType

cssType: string

Gets the CSS fully qualified type name. Using this as element type should allow for PascalCase and kebap-case selectors, when fully qualified, to match the element.

currentEntry

currentEntry: NavigationEntry

Gets the NavigationEntry instance the Frame is currently navigated to.

currentPage

currentPage: Page

Gets the Page instance the Frame is currently navigated to.

dock

dock: "left" | "top" | "right" | "bottom"

domNode

domNode: DOMNode

effectiveBorderBottomWidth

effectiveBorderBottomWidth: number

effectiveBorderLeftWidth

effectiveBorderLeftWidth: number

effectiveBorderRightWidth

effectiveBorderRightWidth: number

effectiveBorderTopWidth

effectiveBorderTopWidth: number

effectiveHeight

effectiveHeight: number

effectiveLeft

effectiveLeft: number

effectiveMarginBottom

effectiveMarginBottom: number

effectiveMarginLeft

effectiveMarginLeft: number

effectiveMarginRight

effectiveMarginRight: number

effectiveMarginTop

effectiveMarginTop: number

effectiveMinHeight

effectiveMinHeight: number

effectiveMinWidth

effectiveMinWidth: number

effectivePaddingBottom

effectivePaddingBottom: number

effectivePaddingLeft

effectivePaddingLeft: number

effectivePaddingRight

effectivePaddingRight: number

effectivePaddingTop

effectivePaddingTop: number

effectiveTop

effectiveTop: number

effectiveWidth

effectiveWidth: number

flexGrow

flexGrow: FlexGrow

flexShrink

flexShrink: FlexShrink

flexWrapBefore

flexWrapBefore: FlexWrapBefore

height

Gets or sets the desired height of the view.

horizontalAlignment

horizontalAlignment: HorizontalAlignment

Gets or sets the alignment of this view within its parent along the Horizontal axis.

id

id: string

Gets or sets the id for this view.

ios

Gets the iOSFrame object that represents the iOS-specific APIs for this Frame. Valid when running on iOS.

isCollapsed

isCollapsed: boolean

Returns true if visibility is set to 'collapse'. Readonly property

isEnabled

isEnabled: boolean

Gets or sets a value indicating whether the the view is enabled. This affects the appearance of the view.

Private isLayoutRequired

isLayoutRequired: boolean

isLayoutValid

isLayoutValid: boolean

Gets is layout is valid. This is a read-only property.

isLoaded

isLoaded: boolean

isUserInteractionEnabled

isUserInteractionEnabled: boolean

Gets or sets a value indicating whether the user can interact with the view. This does not affect the appearance of the view.

left

left: Length

margin

margin: string | PercentLength

Gets or sets margin style property.

marginBottom

marginBottom: PercentLength

Specifies extra space on the bottom side of this view.

marginLeft

marginLeft: PercentLength

Specifies extra space on the left side of this view.

marginRight

marginRight: PercentLength

Specifies extra space on the right side of this view.

marginTop

marginTop: PercentLength

Specifies extra space on the top side of this view.

minHeight

minHeight: Length

Gets or sets the minimum height the view may grow to.

minWidth

minWidth: Length

Gets or sets the minimum width the view may grow to.

nativeView

nativeView: any

nativeViewProtected

nativeViewProtected: any

read-only. If you want to set out-of-band the nativeView use the setNativeView method.

Private navigationBarHeight

navigationBarHeight: number

opacity

opacity: number

Gets or sets the opacity style property.

order

order: Order

originX

originX: number

Gets or sets the X component of the origin point around which the view will be transformed. The deafault value is 0.5 representing the center of the view.

originY

originY: number

Gets or sets the Y component of the origin point around which the view will be transformed. The deafault value is 0.5 representing the center of the view.

page

page: Page

Gets owner page. This is a read-only property.

parent

parent: ViewBase

Gets the parent view. This property is read-only.

parentNode

parentNode: ViewBase

Gets the template parent or the native parent. Sets the template parent.

Private recycleNativeView

recycleNativeView: "always" | "never" | "auto"

rotate

rotate: number

Gets or sets the rotate affine transform of the view.

row

row: number

rowSpan

rowSpan: number

scaleX

scaleX: number

Gets or sets the scaleX affine transform of the view.

scaleY

scaleY: number

Gets or sets the scaleY affine transform of the view.

style

style: Style

Gets the style object associated to this view.

top

top: Length

transition

Gets or sets the default navigation transition for this frame.

translateX

translateX: dip

Gets or sets the translateX affine transform of the view in device independent pixels.

translateY

translateY: dip

Gets or sets the translateY affine transform of the view in device independent pixels.

typeName

typeName: string

Gets the name of the constructor function for this instance. E.g. for a Button class this will return "Button".

verticalAlignment

verticalAlignment: VerticalAlignment

Gets or sets the alignment of this view within its parent along the Vertical axis.

visibility

visibility: Visibility

Gets or sets the visibility of the view.

width

Gets or sets the desired width of the view.

Static androidOptionSelectedEvent

androidOptionSelectedEvent: string

Deprecated. String value used when hooking to androidOptionSelected event (prefix android states that this event is available only in Android).

Static defaultAnimatedNavigation

defaultAnimatedNavigation: boolean

Gets or sets if navigation transitions should be animated globally.

Static defaultTransition

defaultTransition: NavigationTransition

Gets or sets the default NavigationTransition for all frames across the app.

Static loadedEvent

loadedEvent: string

String value used when hooking to loaded event.

Static propertyChangeEvent

propertyChangeEvent: string

String value used when hooking to propertyChange event.

Static unloadedEvent

unloadedEvent: string

String value used when hooking to unloaded event.

Methods

_addView

  • _addView(view: ViewBase, atIndex?: number): void

_addViewCore

  • _addViewCore(view: ViewBase, atIndex?: number): void

_addViewToNativeVisualTree

  • _addViewToNativeVisualTree(view: ViewBase, atIndex?: number): boolean

_applyXmlAttribute

  • _applyXmlAttribute(attribute: any, value: any): boolean

_batchUpdate

  • _batchUpdate<T>(callback: function): T

_childIndexToNativeChildIndex

  • _childIndexToNativeChildIndex(index?: number): number

Private _clearBackStack

  • _clearBackStack(): void

Private _createPropertyChangeData

_eachLayoutView

  • _eachLayoutView(callback: function): void

Private _emit

  • _emit(eventNames: string): any

Private _findEntryForTag

Private _getCurrentLayoutBounds

  • _getCurrentLayoutBounds(): object

_getNativeViewsCount

  • _getNativeViewsCount(): number

Private _getNavBarVisible

  • _getNavBarVisible(page: Page): boolean

_getValue

  • _getValue(property: any): never

Private _goToVisualState

  • _goToVisualState(state: string): any

Private _inheritStyleScope

  • _inheritStyleScope(styleScope: any): void

Private _onCssStateChange

  • _onCssStateChange(): void

_parentChanged

  • _parentChanged(oldParent: ViewBase): void

Private _processNavigationQueue

  • _processNavigationQueue(page: Page): any

Private _redrawNativeBackground

  • _redrawNativeBackground(value: any): void

Private _removeAnimation

  • _removeAnimation(animation: Animation): boolean

_removeView

_removeViewCore

_removeViewFromNativeVisualTree

  • _removeViewFromNativeVisualTree(view: ViewBase): void

Private _setCurrentLayoutBounds

  • _setCurrentLayoutBounds(left: number, top: number, right: number, bottom: number): void

Private _setCurrentMeasureSpecs

  • _setCurrentMeasureSpecs(widthMeasureSpec: number, heightMeasureSpec: number): boolean

Private _setMinHeightNative

  • _setMinHeightNative(value: Length): void

Private _setMinWidthNative

  • _setMinWidthNative(value: Length): void

Private _setNativeClipToBounds

  • _setNativeClipToBounds(): void

Private _setNativeViewFrame

  • _setNativeViewFrame(nativeView: any, frame: any): void

_setValue

  • _setValue(property: any, value: any): never

Private _setupAsRootView

  • _setupAsRootView(context: any): void

_setupUI

  • _setupUI(context: any, atIndex?: number): void
  • Setups the UI for ViewBase and all its children recursively. This method should not be overridden by derived views.

    Parameters

    • context: any
    • Optional atIndex: number

    Returns void

_tearDownUI

  • _tearDownUI(force?: boolean): void

Private _updateActionBar

  • _updateActionBar(page?: Page, disableNavBarAnimation?: boolean): any

Private _updateEffectiveLayoutValues

  • _updateEffectiveLayoutValues(parent: View): void

Private _updateLayout

  • _updateLayout(): void

addEventListener

  • addEventListener(eventNames: string, callback: function, thisArg?: any): any
  • Adds a listener for the specified event name.

    Parameters

    • eventNames: string

      Comma delimited names of the events to attach the listener to.

    • callback: function

      A function to be called when some of the specified event(s) is raised.

    • Optional thisArg: any

      An optional parameter which when set will be used as "this" in callback method call.

    Returns any

Protected addPseudoClass

  • addPseudoClass(name: string): void

animate

bind

canGoBack

  • canGoBack(): boolean

createAnimation

createNativeView

  • createNativeView(): Object

Protected deletePseudoClass

  • deletePseudoClass(name: string): void

disposeNativeView

  • disposeNativeView(): void

eachChild

  • eachChild(callback: function): void

eachChildView

  • eachChildView(callback: function): void

ensureDomNode

  • ensureDomNode(): any

focus

  • focus(): boolean
  • Tries to focus the view. Returns a value indicating whether this view or one of its descendants actually took focus.

    Returns boolean

get

  • get(name: string): any

getActualSize

  • getActualSize(): Size

getGestureObservers

getLocationInWindow

  • getLocationInWindow(): Point

getLocationOnScreen

  • getLocationOnScreen(): Point

getLocationRelativeTo

  • getLocationRelativeTo(otherView: View): Point

getMeasuredHeight

  • getMeasuredHeight(): number

getMeasuredState

  • getMeasuredState(): number

getMeasuredWidth

  • getMeasuredWidth(): number

getViewById

  • getViewById<T>(id: string): T

goBack

  • Navigates to the previous entry (if any) in the back stack.

    Parameters

    • Optional to: BackstackEntry

      The backstack entry to navigate back to.

    Returns any

hasListeners

  • hasListeners(eventName: string): boolean

initNativeView

  • initNativeView(): void

Private isCurrent

layout

  • layout(left: number, top: number, right: number, bottom: number): void
  • Assign a size and position to a view and all of its descendants This is the second phase of the layout mechanism. (The first is measuring). In this phase, each parent calls layout on all of its children to position them. This is typically done using the child measurements that were stored in the measure pass(). Derived classes should not override this method. Derived classes with children should override onLayout. In that method, they should call layout on each of their children.

    Parameters

    • left: number
    • top: number
    • right: number
    • bottom: number

    Returns void

layoutNativeView

  • layoutNativeView(left: number, top: number, right: number, bottom: number): void
  • Called from onLayout when native view position is about to be changed.

    Parameters

    • left: number

      Left position, relative to parent

    • top: number

      Top position, relative to parent

    • right: number

      Right position, relative to parent

    • bottom: number

      Bottom position, relative to parent

    Returns void

measure

  • measure(widthMeasureSpec: number, heightMeasureSpec: number): void
  • This is called to find out how big a view should be. The parent supplies constraint information in the width and height parameters. The actual measurement work of a view is performed in onMeasure(int, int), called by this method. Therefore, only onMeasure(int, int) can and must be overridden by subclasses.

    Parameters

    • widthMeasureSpec: number

      Horizontal space requirements as imposed by the parent

    • heightMeasureSpec: number

      Vertical space requirements as imposed by the parent

    Returns void

navigate

  • navigate(pageModuleName: string): any
  • navigate(create: function): any
  • navigate(entry: NavigationEntry): any
  • Navigates to a Page instance as described by the module name. This method will require the module and will check for a Page property in the exports of the module.

    Parameters

    • pageModuleName: string

      The name of the module to require starting from the application root. For example if you want to navigate to page called "myPage.js" in a folder called "subFolder" and your root folder is "app" you can call navigate method like this: var frames = require("ui/frame"); frames.topmost().navigate("app/subFolder/myPage");

    Returns any

  • Creates a new Page instance using the provided callback and navigates to that Page.

    Parameters

    • create: function

      The function to be used to create the new Page instance.

    Returns any

  • Navigates to a Page resolved by the provided NavigationEntry object. Since there are a couple of ways to specify a Page instance through an entry, there is a resolution priority:

    1. entry.moduleName
    2. entry.create()
    

    Parameters

    Returns any

Private navigationQueueIsEmpty

  • navigationQueueIsEmpty(): boolean

notify

  • notify<T>(data: T): void

notifyPropertyChange

  • notifyPropertyChange(propertyName: string, value: any, oldValue?: any): void

observe

  • observe(type: GestureTypes, callback: function, thisArg?: any): any
  • [Deprecated. Please use the on() instead.] Adds a gesture observer.

    Parameters

    • type: GestureTypes

      Type of the gesture.

    • callback: function

      A function that will be executed when gesture is received.

    • Optional thisArg: any

      An optional parameter which will be used as this context for callback execution.

    Returns any

off

  • off(eventNames: string | GestureTypes, callback?: function, thisArg?: any): any
  • Removes listener(s) for the specified event name.

    Parameters

    • eventNames: string | GestureTypes

      Comma delimited names of the events or gesture types the specified listener is associated with.

    • Optional callback: function

      An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.

    • Optional thisArg: any

      An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.

    Returns any

on

  • on(eventNames: string, callback: function, thisArg?: any): any
  • on(event: "optionSelected", callback: function, thisArg?: any): any
  • A basic method signature to hook an event listener (shortcut alias to the addEventListener method).

    Parameters

    • eventNames: string

      String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by , (e.g. "propertyChange", "change").

    • callback: function

      Callback function which will be executed when event is raised.

    • Optional thisArg: any

      An optional parameter which will be used as this context for callback execution.

    Returns any

  • Raised when native android onOptionsItemSelected method) is called.

    Parameters

    • event: "optionSelected"
    • callback: function
    • Optional thisArg: any

    Returns any

onLayout

  • onLayout(left: number, top: number, right: number, bottom: number): void
  • Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.

    Parameters

    • left: number

      Left position, relative to parent

    • top: number

      Top position, relative to parent

    • right: number

      Right position, relative to parent

    • bottom: number

      Bottom position, relative to parent

    Returns void

onLoaded

  • onLoaded(): void

onMeasure

  • onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void
  • Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents. When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an exception, thrown by measure(int, int).

    Parameters

    • widthMeasureSpec: number

      horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

    • heightMeasureSpec: number

      vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

    Returns void

onResumeNativeUpdates

  • onResumeNativeUpdates(): void

onUnloaded

  • onUnloaded(): void

removeEventListener

  • removeEventListener(eventNames: string, callback?: any, thisArg?: any): any
  • Removes listener(s) for the specified event name.

    Parameters

    • eventNames: string

      Comma delimited names of the events the specified listener is associated with.

    • Optional callback: any

      An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.

    • Optional thisArg: any

      An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.

    Returns any

requestLayout

  • requestLayout(): void

resetNativeView

  • resetNativeView(): void

set

  • set(name: string, value: any): void

Private setCurrent

setInlineStyle

  • setInlineStyle(style: string): void

setMeasuredDimension

  • setMeasuredDimension(measuredWidth: number, measuredHeight: number): void
  • This method must be called by onMeasure(int, int) to store the measured width and measured height. Failing to do so will trigger an exception at measurement time.

    Parameters

    • measuredWidth: number

      The measured width of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL.

    • measuredHeight: number

      The measured height of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL.

    Returns void

setNativeView

  • setNativeView(view: any): void
  • Set the nativeView field performing extra checks and updates to the native properties on the new view. Use in cases where the createNativeView is not suitable. As an example use in item controls where the native parent view will create the native views for child items.

    Parameters

    • view: any

    Returns void

unbind

  • unbind(property: string): void

Static combineMeasuredStates

  • combineMeasuredStates(curState: number, newState: any): number

Static layoutChild

  • layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void
  • Layout a child by taking into account its margins, horizontal and vertical alignments and a given bounds.

    Parameters

    • parent: View

      This parameter is not used. You can pass null.

    • child: View
    • left: number

      Left position, relative to parent

    • top: number

      Top position, relative to parent

    • right: number

      Right position, relative to parent

    • bottom: number

      Bottom position, relative to parent

    Returns void

Static measureChild

  • measureChild(parent: View, child: View, widthMeasureSpec: number, heightMeasureSpec: number): object
  • Measure a child by taking into account its margins and a given measureSpecs.

    Parameters

    • parent: View

      This parameter is not used. You can pass null.

    • child: View

      The view to be measured.

    • widthMeasureSpec: number
    • heightMeasureSpec: number

    Returns object

    • measuredHeight: number

      The measured height that the parent layout specifies for this view.

    • measuredWidth: number

      The measured width that the parent layout specifies for this view.

Static resolveSizeAndState

  • resolveSizeAndState(size: number, specSize: number, specMode: number, childMeasuredState: number): number
  • Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec. Will take the desired size, unless a different size is imposed by the constraints. The returned value is a compound integer, with the resolved size in the {@link #MEASURED_SIZE_MASK} bits and optionally the bit {@link #MEASURED_STATE_TOO_SMALL} set if the resulting size is smaller than the size the view wants to be.

    Parameters

    • size: number
    • specSize: number
    • specMode: number
    • childMeasuredState: number

    Returns number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method