8.8 released—CSS Media Query support, SF Symbols and much more...
Learn more

Summary

Classes

AbsoluteLayout
ActionBar
ActionItem
ActionItems
ActivityIndicator
AndroidApplication
Animation
ApplicationCommon
Background
Binding
Builder
Button
ChangeType
CoercibleProperty
Color
ContainerView
ContentView
ControlStateChangeListener
CssAnimationParser
CssAnimationProperty
CssProperty
CustomLayoutView
DatePicker
DockLayout
EditableTextBase
FadeTransition
File
FileSystemEntity
FlexboxLayout
Folder
Font
FormattedString
Frame
GesturesObserver
GridLayout
HtmlView
Image
ImageAsset
ImageCache
ImageSource
InheritedCssProperty
InheritedProperty
iOSApplication
ItemSpec
KeyframeAnimation
KeyframeAnimationInfo
Label
LayoutBase
ListPicker
ListView
ModalTransition
ModuleNameResolver
NavigationButton
Observable
ObservableArray
Page
PageBase
PageTransition
ParserEventType
Placeholder
Progress
Property
ProxyViewContainer
Repeater
RootLayout
Screen
ScrollView
SearchBar
SegmentedBar
SegmentedBarItem
SharedTransition
SharedTransitionHelper
ShorthandProperty
Slider
SlideTransition
Span
StackLayout
Style
Switch
TabView
TabViewItem
TextBase
TextField
TextView
TimePicker
TouchManager
Transition
View
ViewBase
ViewCommon
ViewHelper
VirtualArray
WebView
WrapLayout
WrappedValue
XmlParser

Interfaces

ActionOptions
AddArrayFromBuilder
AddChildFromBuilder
AlertOptions
AndroidActivityBackPressedEventData
AndroidActivityBundleEventData
AndroidActivityCallbacks
AndroidActivityEventData
AndroidActivityNewIntentEventData
AndroidActivityRequestPermissionsEventData
AndroidActivityResultEventData
AnimationDefinition
ApplicationEventData
BackstackEntry
BindingOptions
CancelableOptions
ChangedData
CommonLayoutParams
ComponentModule
ConfirmOptions
CreateViewEventData
CssChangedEventData
DialogOptions
DiscardedErrorEventData
DownloadedData
DownloadError
DownloadRequest
EventData
FontScaleChangedEventData
GestureEventData
GestureEventDataWithState
HttpContent
HttpRequestOptions
HttpResponse
IDevice
ImageAssetOptions
ItemEventData
ItemsLoading
ItemsSource
KeyedTemplate
KeyframeDeclaration
KeyframeInfo
LaunchEventData
LoadAppCSSEventData
LoadEventData
LoadOptions
LoginOptions
LoginResult
NativeScriptConfig
NativeScriptError
NavigatedData
NavigationContext
NavigationEntry
NavigationTransition
OrientationChangedEventData
PanGestureEventData
ParserEvent
PinchGestureEventData
PlatformContext
PromptOptions
PromptResult
PropertyChangeData
RootLayoutOptions
RotationGestureEventData
ScrollEventData
ShadeCoverOptions
SharedTransitionConfig
ShowModalOptions
ShownModallyData
Size
SwipeGestureEventData
SystemAppearanceChangedEventData
TapGestureEventData
Template
TemplatedItemsView
TimerInfo
TouchGestureEventData
TraceErrorHandler
TraceEventListener
TraceWriter
UnhandledErrorEventData
ViewEntry

Variables

_resetRootView
addCss
android
androidDynamicElevationOffsetProperty
androidElevationProperty
AnimationCurve
Application
autocapitalizationTypeProperty
autocorrectProperty
backgroundColorProperty
backgroundEvent
backgroundImageProperty
backgroundInternalProperty
backgroundPositionProperty
backgroundProperty
backgroundRepeatProperty
backgroundSizeProperty
borderBottomColorProperty
borderBottomLeftRadiusProperty
borderBottomRightRadiusProperty
borderBottomWidthProperty
borderColorProperty
borderLeftColorProperty
borderLeftWidthProperty
borderRadiusProperty
borderRightColorProperty
borderRightWidthProperty
borderTopColorProperty
borderTopLeftRadiusProperty
borderTopRightRadiusProperty
borderTopWidthProperty
borderWidthProperty
clipPathProperty
colorProperty
CSSHelper
Device
Dialogs
discardedErrorEvent
displayedEvent
editableProperty
Enums
exitEvent
fontFamilyProperty
fontInternalProperty
fontScaleChangedEvent
fontScaleInternalProperty
fontSizeProperty
fontStyleProperty
fontWeightProperty
foregroundEvent
getCssFileName
getMainEntry
getNativeApplication
getResources
getRootView
hasLaunched
hasListeners
heightProperty
hintProperty
horizontalAlignmentProperty
inBackground
ios
isAndroid
isIOS
isUserInteractionEnabledProperty
keyboardTypeProperty
launchEvent
letterSpacingProperty
lineHeightProperty
loadAppCss
lowMemoryEvent
marginBottomProperty
marginLeftProperty
marginProperty
marginRightProperty
marginTopProperty
maxLengthProperty
minHeightProperty
minWidthProperty
notify
off
on
opacityProperty
orientation
orientationChangedEvent
paddingBottomProperty
paddingLeftProperty
paddingProperty
paddingRightProperty
paddingTopProperty
placeholderColorProperty
platformNames
resetRootView
resumeEvent
returnKeyTypeProperty
rotateProperty
run
scaleXProperty
scaleYProperty
setAutoSystemAppearanceChanged
setCssFileName
setMaxRefreshRate
setResources
suspended
suspendEvent
systemAppearance
systemAppearanceChanged
systemAppearanceChangedEvent
textAlignmentProperty
textDecorationProperty
textShadowProperty
textTransformProperty
translateXProperty
translateYProperty
uncaughtErrorEvent
unsetValue
updateTextTriggerProperty
verticalAlignmentProperty
visibilityProperty
whiteSpaceProperty
widthProperty
zeroLength
zIndexProperty

References

Type Aliases

Headers

HorizontalAlignment

InstrumentationMode

InstrumentationMode: "counters" | "timeline" | "lifecycle"
Profiling mode to use. - `counters` Accumulates method call counts and times until dumpProfiles is called and then prints aggregated statistic in the console. This is the default. - `timeline` Outputs method names along start/end timestamps in the console on the go. - `lifecycle` Outputs basic non-verbose times for startup, navigation, etc.

LengthPercentUnit

ModuleListProvider

ModuleListProvider: () => string[]

PercentLengthType

SharedTransitionTagProperties

SharedTransitionTagProperties: SharedProperties & {
callback?: (view: View, action: SharedTransitionEventAction) => Promise<void>;
propertiesToMatch?: SharedTransitionTagPropertiesToMatch;
}
Properties which can be set on individual Shared Elements

TouchAnimationOptions

TouchAnimationOptions: {
  down?: TouchAnimationFn | AnimationDefinition
}

VerticalAlignment

WebViewNavigationType

WebViewNavigationType: "linkClicked" | "formSubmitted" | "backForward" | "reload" | "formResubmitted" | "other" | undefined
Represents navigation type

percent

Variables

AnimationCurve

CSSHelper

CSSHelper: {
  AttributeSelector: typeof AttributeSelector
  ClassSelector: typeof ClassSelector
  InvalidSelector: typeof InvalidSelector
  PseudoClassSelector: typeof PseudoClassSelector
  RuleSet: typeof RuleSet
  Selector: typeof Selector
  SelectorCore: typeof SelectorCore
  SelectorsMap: typeof SelectorsMap
  SelectorsMatch: typeof SelectorsMatch
  SimpleSelector: typeof SimpleSelector
  SimpleSelectorSequence: typeof SimpleSelectorSequence
  TypeSelector: typeof TypeSelector
  UniversalSelector: typeof UniversalSelector
  createSelector: typeof createSelector
}

Device

Device: IDevice
Gets the current device information.

Dialogs

Dialogs: {
action: typeof action;
alert: typeof alert;
confirm: typeof confirm;
login: typeof login;
}
Singular rollup for convenience of all dialog methods

Enums

Enums: {
Accuracy: typeof Accuracy;
AndroidActionBarIconVisibility: typeof AndroidActionBarIconVisibility;
AndroidActionItemPosition: typeof AndroidActionItemPosition;
AnimationCurve: typeof AnimationCurve;
AutocapitalizationType: typeof AutocapitalizationType;
BackgroundRepeat: typeof BackgroundRepeat;
DeviceOrientation: typeof DeviceOrientation;
DeviceType: typeof DeviceType;
Dock: typeof Dock;
FontAttributes: typeof FontAttributes;
FontStyle: typeof FontStyle;
FontWeight: typeof FontWeight;
HorizontalAlignment: typeof HorizontalAlignment;
IOSActionItemPosition: typeof IOSActionItemPosition;
ImageFormat: typeof ImageFormat;
KeyboardType: typeof KeyboardType;
NavigationBarVisibility: typeof NavigationBarVisibility;
Orientation: typeof Orientation;
ReturnKeyType: typeof ReturnKeyType;
StatusBarStyle: typeof StatusBarStyle;
Stretch: typeof ImageStretch;
SystemAppearance: typeof SystemAppearance;
TextAlignment: typeof TextAlignment;
TextDecoration: typeof TextDecoration;
TextTransform: typeof TextTransform;
UpdateTextTrigger: typeof UpdateTextTrigger;
VerticalAlignment: typeof VerticalAlignment;
Visibility: typeof Visibility;
}

_resetRootView

android

androidDynamicElevationOffsetProperty

androidDynamicElevationOffsetProperty: CssProperty<Style, number>

androidElevationProperty

autocapitalizationTypeProperty

autocorrectProperty

backgroundColorProperty

backgroundEvent

backgroundEvent: "background" = "background"

backgroundImageProperty

backgroundInternalProperty

backgroundPositionProperty

backgroundPositionProperty: CssProperty<Style, string>

backgroundProperty

backgroundRepeatProperty

backgroundSizeProperty

borderBottomColorProperty

borderBottomLeftRadiusProperty

borderBottomRightRadiusProperty

borderBottomWidthProperty

borderColorProperty

borderLeftColorProperty

borderLeftWidthProperty

borderRadiusProperty

borderRightColorProperty

borderRightWidthProperty

borderTopColorProperty

borderTopLeftRadiusProperty

borderTopRightRadiusProperty

borderTopWidthProperty

borderWidthProperty

clipPathProperty

discardedErrorEvent

discardedErrorEvent: "discardedError" = "discardedError"

displayedEvent

displayedEvent: "displayed" = "displayed"

editableProperty

exitEvent

fontFamilyProperty

fontScaleChangedEvent

fontScaleChangedEvent: "fontScaleChanged" = "fontScaleChanged"

fontScaleInternalProperty

fontSizeProperty

fontStyleProperty

fontWeightProperty

foregroundEvent

foregroundEvent: "foreground" = "foreground"

getCssFileName

getMainEntry

getNativeApplication

getResources

hasListeners

horizontalAlignmentProperty

inBackground

isAndroid

isAndroid: boolean
Gets a value indicating if the app is running on the Android platform.

isIOS

isIOS: boolean
Gets a value indicating if the app is running on the iOS platform.

isUserInteractionEnabledProperty

isUserInteractionEnabledProperty: Property<View, boolean>

launchEvent

launchEvent: "launch" = "launch"

letterSpacingProperty

letterSpacingProperty: CssProperty<Style, number>

lineHeightProperty

lowMemoryEvent

lowMemoryEvent: "lowMemory" = "lowMemory"

maxLengthProperty

orientationChangedEvent

orientationChangedEvent: "orientationChanged" = "orientationChanged"

paddingBottomProperty

paddingRightProperty

placeholderColorProperty

platformNames

platformNames: {
  android: string
}

resetRootView

resumeEvent

resumeEvent: "resume" = "resume"

setAutoSystemAppearanceChanged

setAutoSystemAppearanceChanged: any

setCssFileName

setMaxRefreshRate

setResources

suspendEvent

suspendEvent: "suspend" = "suspend"

systemAppearance

systemAppearanceChanged

systemAppearanceChanged: any

systemAppearanceChangedEvent

systemAppearanceChangedEvent: "systemAppearanceChanged" = "systemAppearanceChanged"

textDecorationProperty

textShadowProperty

textShadowProperty: CssProperty<Style, CSSShadow>

textTransformProperty

uncaughtErrorEvent

uncaughtErrorEvent: "uncaughtError" = "uncaughtError"

unsetValue

unsetValue: any
Value specifying that Property should be set to its initial value.

verticalAlignmentProperty

whiteSpaceProperty

zIndexProperty

Functions

CSSType

CSSType(type: string): ClassDecorator
Specifies the type name for the instances of this View class, that is used when matching CSS type selectors. Usage: ``` @CSSType("Button") class Button extends View { } ``` Internally the decorator set `Button.prototype.cssType = "Button"`.
Parameter Default Description
type
string

The type name, e. g. "Button", "Label", etc.

Returns ClassDecorator

PseudoClassHandler

PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator
Parameter Default Description
pseudoClasses
string[]

Returns MethodDecorator

_setResolver

_setResolver(resolver: ModuleNameResolver): any
Used to set a global singular instance of ModuleNameResolver
Parameter Default Description
resolver

instance

Returns any

action

action(message: string, cancelButtonText: string, actions: string[]): Promise&lt;string&gt;
The action() method displays a action box that prompts the visitor to choose some action.
Parameter Default Description
message
string

The text to display in the dialog box.

cancelButtonText
string

The text to display in the cancel button.

actions
string[]

List of available actions.

Returns Promise<string>
action(options: ActionOptions): Promise<string>
The action() method displays a action box that prompts the visitor to choose some action.
Parameter Default Description
options

The options for the dialog box.

Returns Promise<string>

addTaggedAdditionalCSS

addTaggedAdditionalCSS(cssText: string, tag?: string | Number): boolean
Parameter Default Description
cssText
string

tag
string | Number

Returns boolean

addWeakEventListener

addWeakEventListener(source: Observable, eventName: string, handler: (eventData: EventData) => void, target: any): void
Attaches a WeakEventListener.
Parameter Default Description
source

Observable class which emits the event.

eventName
string

The event name.

handler
(eventData: EventData) => void

The function which should be called when event occurs.

target
any

Subscriber (target) of the event listener. It will be used as a thisArg in the handler function.

Returns void

alert

alert(message: string | number | boolean): Promise&lt;void&gt;
The alert() method displays an alert box with a specified message.
Parameter Default Description
message
string | number | boolean

Specifies the text to display in the alert box.

Returns Promise<void>
alert(options: AlertOptions): Promise<void>
The alert() method displays an alert box with a specified message.
Parameter Default Description
options

Specifies the options for the alert box.

Returns Promise<void>

animationTimingFunctionConverter

animationTimingFunctionConverter(value: string): any
Parameter Default Description
value
string

Returns any

booleanConverter

booleanConverter(v: string | boolean): boolean
Parameter Default Description
v
string | boolean

Returns boolean

confirm

confirm(message: string): Promise&lt;boolean&gt;
The confirm() method displays a dialog box with a specified message.
Parameter Default Description
message
string

Specifies the text to display in the confirm box.

Returns Promise<boolean>
confirm(options: ConfirmOptions): Promise<boolean>
The confirm() method displays a dialog box with a specified message.
Parameter Default Description
options

Specifies the options for the confirm box.

Returns Promise<boolean>

eachDescendant

eachDescendant(view: ViewBase, callback: (child: ViewBase) => boolean): void
Iterates through all child views (via visual tree) and executes a function.
Parameter Default Description
view

Starting view (parent container).

callback
(child: ViewBase) => boolean

A function to execute on every child. If function returns false it breaks the iteration.

Returns void

fromObject

fromObject(source: any): Observable
Creates an Observable instance and sets its properties according to the supplied JavaScript object. param obj - A JavaScript object used to initialize nativescript Observable instance.
Parameter Default Description
source
any

Returns Observable

fromObjectRecursive

fromObjectRecursive(source: any): Observable
Creates an Observable instance and sets its properties according to the supplied JavaScript object. This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object. param obj - A JavaScript object used to initialize nativescript Observable instance.
Parameter Default Description
source
any

Returns Observable

getAncestor

getAncestor(view: ViewBase, criterion: string | () => any): ViewBase
Gets an ancestor from a given type.
Parameter Default Description
view

Starting view (child view).

criterion
string | () => any

The type of ancestor view we are looking for. Could be a string containing a class name or an actual type. Returns an instance of a view (if found), otherwise undefined.

Returns ViewBase

getCurrentPage

getFileAccess

getFileAccess(): FileSystemAccess
Returns FileSystemAccess, a shared singleton utility class to provide methods to access and work with the file system. This is used under the hood of all the file system apis in @nativescript/core and provided as a lower level convenience if needed.
Returns FileSystemAccess

getRootLayout

getTransformedText

getTransformedText(text: string, textTransform: TextTransformType): string
Parameter Default Description
text
string

textTransform

Returns string

getViewById

getViewById(view: ViewBase, id: string): ViewBase
Gets a child view by id.
Parameter Default Description
view

The parent (container) view of the view to look for.

id
string

The id of the view to look for. Returns an instance of a view (if found), otherwise undefined.

Returns ViewBase

login

login(message: string, userNameHint?: string, passwordHint?: string, userName?: string, password?: string): Promise<LoginResult>
The login() method displays a login dialog box that prompts the visitor for user name and password.
Parameter Default Description
message
string

The text to display in the dialog box.

userNameHint
string

The default text to display as a hint in the username input. Optional.

passwordHint
string

The default text to display as a hint in the password input. Optional.

userName
string

The default text to display in the user name input box. Optional.

password
string

The default text to display in the password input box. Optional.

Returns Promise<LoginResult>
login(message: string, userNameHint?: string, passwordHint?: string): Promise<LoginResult>
The login() method displays a login dialog box that prompts the visitor for user name and password.
Parameter Default Description
message
string

The text to display in the dialog box.

userNameHint
string

The default text to display as a hint in the username input. Optional.

passwordHint
string

The default text to display as a hint in the password input. Optional.

Returns Promise<LoginResult>
login(options: LoginOptions): Promise<LoginResult>
The login() method displays a login dialog box that prompts the visitor for user name and password.
Parameter Default Description
options

The options for the dialog box.

Returns Promise<LoginResult>

makeParser

makeParser&lt;T&gt;(isValid: (value: any) => boolean, allowNumbers?: boolean): (value: any) => T
Parameter Default Description
isValid
(value: any) => boolean

allowNumbers
boolean

Returns (value: any) => T

makeValidator

makeValidator&lt;T&gt;(...values: T[]): (value: any) => value is T
Parameter Default Description
values
T[]

Returns (value: any) => value is T

parseCSSShadow

parseCSSShadow(value: string): CSSShadow
Parse a string into a CSSShadow Supports any valid css box/text shadow combination. inspired by https://github.com/jxnblk/css-box-shadow/blob/master/index.js (MIT License)
Parameter Default Description
value
string

Returns CSSShadow

parseKeyframeDeclarations

parseKeyframeDeclarations(unparsedKeyframeDeclarations: KeyframeDeclaration[]): KeyframeDeclaration[]
Parameter Default Description
unparsedKeyframeDeclarations

profile

profile(name?: string): MethodDecorator
Method decorator factory. It will intercept the method call and start and pause a timer before and after the method call. Works only if profiling is enabled.
Parameter Default Description
name
string

Name of the timer which will be used for method calls. If not provided - the name of the method will be used.

Returns MethodDecorator
profile&lt;F&gt;(fn: F): F
Function factory. It will intercept the function call and start and pause a timer before and after the function call. Works only if profiling is enabled. Works only if profiling is enabled.
Parameter Default Description
fn
F

The function to wrap. Uses the function name to track the times.

Returns F
profile&lt;F&gt;(name: string, fn: F): F
Function factory. It will intercept the function call and start and pause a timer before and after the function call. Works only if profiling is enabled.
Parameter Default Description
name
string

The name used to track calls and times.

fn
F

The function to wrap.

Returns F
profile&lt;T&gt;(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor&lt;T&gt;): TypedPropertyDescriptor&lt;T&gt; | void
Method decorator. It will intercept the method calls and start and pause a timer before and after the method call. Works only if profiling is enabled.
Parameter Default Description
target
Object

propertyKey
string | symbol

descriptor
TypedPropertyDescriptor<T>

Returns TypedPropertyDescriptor<T> | void
profile(): any

profilingDisable

profilingDisable(): void
Disables profiling.
Returns void

profilingDumpProfiles

profilingDumpProfiles(): void
Prints the timer for all methods instrumented with profile decorator.
Returns void

profilingEnable

profilingEnable(type?: InstrumentationMode): void
Enables profiling. Upon loading of the module it will cache the package.json of the app and check if there is a "profiling" key set, its value can be one of the options available for InstrumentationMode, and if set, enable() will be called in pre app start with the value in the package.json. An example for an `app/package.json` enabling the manual instrumentation profiling is: ``` { "main": "main.js", "profiling": "timeline" } ```
Parameter Default Description
type

Profiling mode to use. - "counters" - Accumulates method call counts and times until dumpProfiles is called and then prints aggregated statistic in the console. This is the default. - "timeline" - Outputs method names along start/end timestamps in the console on the go. - "lifecycle" - Outputs basic non-verbose times for startup, navigation, etc.

Returns void

profilingIsRunning

profilingIsRunning(name: string): boolean
Returns true if a timer is currently running.
Parameter Default Description
name
string

Name of the timer.

Returns boolean

profilingResetProfiles

profilingResetProfiles(): void
Resets the timers for all methods instrumented with profile decorator.
Returns void

profilingStart

profilingStart(name: string): void
Starts a timer with a specific name. Works only if profiling is enabled.
Parameter Default Description
name
string

Name of the timer.

Returns void

profilingStartCPU

profilingStartCPU(name: string): void
Starts android cpu profiling.
Parameter Default Description
name
string

Name of the cpu profiling session.

Returns void

profilingStop

profilingStop(name: string): TimerInfo
Pauses a timer with a specific name. This will increase call count and accumulate time. Works only if profiling is enabled.
Parameter Default Description
name
string

Name of the timer.

Returns TimerInfo

profilingStopCPU

profilingStopCPU(name: string): void
Stops android cpu profiling.
Parameter Default Description
name
string

Name of the cpu profiling session.

Returns void

profilingTime

profilingTime(): number
Gets accurate system timestamp in ms.
Returns number

profilingUptime

profilingUptime(): number
Gets the uptime of the current process in milliseconds.
Returns number

prompt

prompt(message: string, defaultText?: string): Promise<PromptResult>
The prompt() method displays a dialog box that prompts the visitor for input.
Parameter Default Description
message
string

The text to display in the dialog box.

defaultText
string

The default text to display in the input box. Optional.

Returns Promise<PromptResult>
prompt(options: PromptOptions): Promise<PromptResult>
The prompt() method displays a dialog box that prompts the visitor for input.
Parameter Default Description
options

The options for the dialog box.

Returns Promise<PromptResult>

querySelectorAll

querySelectorAll(view: ViewBase, selector: string): ViewBase[]
Gets a child view by selector.
Parameter Default Description
view

The parent (container) view of the view to look for.

selector
string

The selector of the view to look for. Returns an instance of a view (if found), otherwise undefined.

Returns ViewBase[]

removeTaggedAdditionalCSS

removeTaggedAdditionalCSS(tag: String | Number): boolean
Parameter Default Description
tag
String | Number

Returns boolean

removeWeakEventListener

removeWeakEventListener(source: Observable, eventName: string, handler: (eventData: EventData) => void, target: any): void
Removes a WeakEventListener.
Parameter Default Description
source

Observable class which emits the event.

eventName
string

The event name.

handler
(eventData: EventData) => void

The function which should be called when event occurs.

target
any

Subscriber (target) of the event listener. It will be used as a thisArg in the handler function.

Returns void

resolveFileNameFromUrl

resolveFileNameFromUrl(
  url: string,
  appDirectory: string,
  fileExists: (filepath: string) => boolean,
  importSource?: string
): string
Parameter Default Description
url
string

appDirectory
string

fileExists
(filepath: string) => boolean

importSource
string

Returns string

setActivityCallbacks

setActivityCallbacks(activity: any): void
Parameter Default Description
activity
any

Returns void

timeConverter

timeConverter(value: string): number
Parameter Default Description
value
string

Returns number

transformConverter

transformConverter(text: string): TransformFunctionsInfo
Parameter Default Description
text
string

Returns TransformFunctionsInfo