# Titanium.UI.AlertDialog

An alert dialog is a modal view that includes an optional title, a message and buttons, positioned in the middle of the display.

Availability
0.8
0.8
9.2.0

# Overview

Android iOS
Android iOS

An alert dialog is created using Titanium.UI.createAlertDialog or <AlertDialog> Alloy element.

Although this dialog always appears in the middle of the display (not touching the edges), other aspects of its aesthetics and the way the user interacts with it are different for each platform, as described below.

# Android

On Android, the default alert dialog displays text information, via a title and message, without any buttons. As the user can use the system hardware back button to dismiss it, a button is optional.

Buttons are shown if the buttonNames property is defined, and are rendered horizontally below the message.

To create a custom layout, a view may be added and, in turn, a hierarchy of views added to that child view.

# iOS

On iOS, the default alert dialog displays text information, via a title and message, with a single button to allow it to be dismissed.

Buttons are defined using the buttonNames property and are rendered vertically below the message. Alert dialogs are automatically cancelled when the application is paused/suspended. This behavior can be avoided by setting persistent property on alert dialog to be true.

The style property can be used to allow the user to enter plain text, obscured text or login identifier and password. Entered values can be captured with listening cancel event.

Starting at Titanium SDK 5.1.0, you can also specify the placeholder, keyboardType and returnKeyType properties when using the alert dialog style Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT. When using the alert dialog style Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT, you can specify the loginPlaceholder, loginKeyboardType and loginReturnKeyType properties for the login field, as well as the passwordPlaceholder, passwordKeyboardType and passwordReturnKeyType properties for the password field.

# Global Alias

A global method alert() is aliased to this object, and can be invoked with a single message. For example

alert('this is a message');

This will generate an alert with a title of "Alert" and an "OK" button.

# Caveats

Multiple alerts should not be shown at once.

The title and ok properties cannot be changed while the alert dialog is being displayed. On Android only, you can change the message property while the alert dialog is being displayed.

# Examples

# Single-button Alert Dialog (using alias)

Create a single-button alert dialog using the global alert() alias.

var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white'
});

win.addEventListener('click', function(e) {
  alert('The file has been deleted');
});
win.open();

# Single-button Alert Dialog (standard)

Create a single-button alert dialog, without explicitly defining it using the buttonNames property, which is invoked when the app window is clicked.

var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white'
});

win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    message: 'The file has been deleted',
    ok: 'Okay',
    title: 'File Deleted'
  });
  dialog.show();
});
win.open();

# Three-button Alert Dialog

Create a three-button alert dialog, which is invoked when the app window is clicked. Output a message to the log when the cancel button is clicked.

var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white'
});
win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    cancel: 1,
    buttonNames: ['Confirm', 'Cancel', 'Help'],
    message: 'Would you like to delete the file?',
    title: 'Delete'
  });
  dialog.addEventListener('click', function(e) {
    if (e.index === e.source.cancel) {
      Ti.API.info('The cancel button was clicked');
    }
    Ti.API.info('e.cancel: ' + e.cancel);
    Ti.API.info('e.source.cancel: ' + e.source.cancel);
    Ti.API.info('e.index: ' + e.index);
  });
  dialog.show();
});
win.open();

# Alert Dialog with Plain Text Input

Create an alert dialog and allow the user enter plain text, which is invoked when the app window is clicked. Output entered text value to the log when the OK button is clicked.

var win = Ti.UI.createWindow({
  title: 'Click window to test'
});
win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    title: 'Enter text',
    style: Ti.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT,
    buttonNames: ['OK']
  });
  dialog.addEventListener('click', function(e) {
    Ti.API.info('e.text: ' + e.text);
  });
  dialog.show();
});
win.open();

# Alloy XML Markup

Previous three-button alert dialog example as an Alloy view.

alertdialog.xml:

<Alloy>
    <Window id="win" onClick="showDialog" title="Click window to test" backgroundColor="white"
        exitOnClose="true" fullscreen="false" >

        <AlertDialog id="dialog" onClick="doClick" title="Delete"
            message="Would you like to delete the file?" cancel="1">

            <!-- The ButtonNames tag sets the buttonNames property. -->
            <ButtonNames>
                <ButtonName>Confirm</ButtonName>
                <ButtonName>Cancel</ButtonName>
                <ButtonName>Help</ButtonName>
            </ButtonNames>
        </AlertDialog>
    </Window>
</Alloy>

alertdialog.js:

function showDialog() {
    $.dialog.show();
}

function doClick(e) {
    Ti.API.info('e.text: ' + e.text);
}

$.win.open();

# Properties

# accessibilityDisableLongPress CREATION ONLY

Availability
12.4.0
accessibilityDisableLongPress :Boolean

Boolean value to remove the long press notification for the device's accessibility service.

Will disable the "double tap and hold for long press" message when selecting an item.

Default: true


# androidView CREATION ONLY

Availability
0.8
androidView :Titanium.UI.View

View to load inside the message area, to create a custom layout.

In an Alloy application you can specify this property with either an <AndroidView/> or <View/> element inside the <AlertDialog/> element, for example:

<Alloy>
    <AlertDialog onClick="doClick" title="Delete"
        message="Would you like to delete the file?" cancel="1">

        <!--  Add View or AndroidView for the androidView property  -->
        <View platform="android">
            <Label color="red" text="Warning!  This change is permanent and you cannot undo it!" />
        </View>

        <ButtonNames>
            <ButtonName>Confirm</ButtonName>
            <ButtonName>Cancel</ButtonName>
        </ButtonNames>
    </AlertDialog>
</Alloy>

# apiName READONLY

Availability
3.2.0
3.2.0
9.2.0
apiName :String

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Titanium.UI.Button returns Ti.UI.Button.


# bubbleParent

Availability
3.0.0
3.0.0
9.2.0
bubbleParent :Boolean

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true


# buttonClickRequired

Availability
7.5.0
buttonClickRequired :Boolean

Setting this to true requires the end-user to click a dialog button to close the dialog.

Set to true to prevent the dialog from being dismissed via back navigation or tapping outside of the dialog. This requires the end-user to click on one of the dialog buttons provided by property buttonNames. Note that if the dialog does not have any buttons, then the dialog can only be closed programmatically via the hide() method.

Default: false on Android


# buttonNames CREATION ONLY

Availability
0.8
0.8
9.2.0
buttonNames :Array<String>

Name of each button to create.

On iOS, a button will automatically be created if none are explicitly defined, because without it users would be unable to dismiss the dialog. Conversely, a dialog with no buttons may be created on Android, as the hardware back button may be used instead.

A maximum of 3 buttons is supported on Android.

Alloy applications can specify this property with a <ButtonNames> element containing one or more <ButtonName> elements (see example).

<Alloy>
    <AlertDialog id="dialog" onClick="doClick" title="Decide!" message="Do you really want to do that?" cancel="1">
        <ButtonNames>
            <ButtonName>Confirm</ButtonName>
            <ButtonName>Cancel</ButtonName>
            <ButtonName>Help</ButtonName>
        </ButtonNames>
    </AlertDialog>
</Alloy>

Default: No buttons (Android), Single "OK" button (iOS)


# cancel

Availability
0.8
0.8
9.2.0
cancel :Number

Index to define the cancel button.

On iOS, set to -1 to disable the cancel option.

Default: undefined (Android), -1 (iOS)


# canceledOnTouchOutside

Availability
6.0.0
canceledOnTouchOutside :Boolean

When this is set to true, the dialog is canceled when touched outside the window's bounds.

Default: true on Android


# destructive

Availability
3.5.0
9.2.0
destructive :Number

Index to define the destructive button.

Setting this property to -1 disables this option.

Default: -1


# elevation

Availability
5.0.0
elevation :Number

Base elevation of the view relative to its parent in pixels.

The elevation of a view determines the appearance of its shadow. Higher elevations produce larger and softer shadows.

Note: The elevation property only works on Titanium.UI.View objects. Many Android components have a default elevation that cannot be modified. For more information, see Google design guidelines: Elevation and shadows.


# filterTouchesWhenObscured

Availability
9.3.0
filterTouchesWhenObscured :Boolean

Discards touch related events if another app's system overlay covers the view.

This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay.

Setting this property to true causes touch related events (including "click") to not be fired if a system overlay overlaps the view.

Default: false


# hiddenBehavior

Availability
6.1.0
hiddenBehavior :Number

Sets the behavior when hiding an object to release or keep the free space

If setting hiddenBehavior to HIDDEN_BEHAVIOR_GONE it will automatically release the space the view occupied. For example: in a vertical layout the views below the object will move up when you hide an object with hiddenBehavior:Titanium.UI.HIDDEN_BEHAVIOR_GONE.

Defaults to Titanium.UI.HIDDEN_BEHAVIOR_INVISIBLE.

This API can be assigned the following constants:

# hintText

Availability
5.4.0
9.2.0
hintText :String

Hint text of the text field inside the dialog.

Note that this property is only available if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.


# hinttextid

Availability
6.2.0
9.2.0
hinttextid :String

Key identifying a string from the locale file to use for the hintText property.

Only one of hintText or hinttextid should be specified.


# horizontalMotionEffect

Availability
7.3.0
9.2.0
horizontalMotionEffect :MinMaxOptions

Adds a horizontal parallax effect to the view

Note that the parallax effect only happens by tilting the device so results can not be seen on Simulator. To clear all motion effects, use the <Titanium.UI.clearMotionEffects> method.


# id

Availability
0.9
0.9
9.2.0
id :String

View's identifier.

The id property of the Ti.UI.View represents the view's identifier. The identifier string does not have to be unique. You can use this property with getViewById method.


# keyboardAppearance

Availability
5.2.0
9.2.0
keyboardAppearance :Number

Keyboard appearance to be displayed when the text field inside the dialog is focused.

Note that this property is only available if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.

Default: Titanium.UI.KEYBOARD_APPEARANCE_DEFAULT


# lifecycleContainer

Availability
3.6.0

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.


# loginHintText

Availability
5.4.0
9.2.0
loginHintText :String

Hint text of the login text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# loginhinttextid

Availability
6.2.0
9.2.0
loginhinttextid :String

Key identifying a string from the locale file to use for the loginHintText property.

Only one of loginHintText or loginhinttextid should be specified.


# loginKeyboardType

Availability
5.1.0
5.1.0
9.2.0
loginKeyboardType :Number

Keyboard type to display when this text field inside the dialog is focused.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

Default: Titanium.UI.KEYBOARD_DEFAULT


# loginPlaceholder DEPRECATED

Availability
5.1.0
9.2.0
loginPlaceholder :String

DEPRECATED SINCE 5.4.0

Use loginHintText instead.

Placeholder of the login text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# loginReturnKeyType

Availability
5.1.0
5.1.0
9.2.0
loginReturnKeyType :Number

Specifies the text to display on the keyboard Return key when this field is focused.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

Default: Titanium.UI.RETURNKEY_NEXT


# loginValue

Availability
6.1.0
9.2.0
loginValue :String

Value of the login text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# message

Availability
0.8
0.8
9.2.0
message :String

Dialog message.


# messageid

Availability
0.8
0.8
9.2.0
messageid :String

Key identifying a string in the locale file to use for the message text.


# ok

Availability
0.8
0.8
9.2.0
ok :String

Text for the OK button.

This property is useful when only one button is required, as it negates the need to define the buttonNames property. If buttonNames is defined, this property is ignored.


# okid

Availability
0.8
9.2.0
okid :String

Key identifying a string in the locale file to use for the ok text.

If buttonNames is defined, this property is ignored.


# passwordHintText

Availability
5.4.0
9.2.0
passwordHintText :String

Hint text of the password text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# passwordhinttextid

Availability
6.2.0
9.2.0
passwordhinttextid :String

Key identifying a string from the locale file to use for the passwordHintText property.

Only one of passwordHintText or hinttextid should be specified.


# passwordKeyboardType

Availability
5.1.0
5.1.0
9.2.0
passwordKeyboardType :Number

Keyboard type to display when this text field inside the dialog is focused.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

Default: Titanium.UI.KEYBOARD_DEFAULT


# passwordPlaceholder DEPRECATED

Availability
5.1.0
9.2.0
passwordPlaceholder :String

DEPRECATED SINCE 5.4.0

Use passwordHintText instead.

Placeholder of the password text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# passwordReturnKeyType

Availability
5.1.0
5.1.0
9.2.0
passwordReturnKeyType :Number

Specifies the text to display on the keyboard Return key when this field is focused.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

Default: Titanium.UI.RETURNKEY_DONE


# passwordValue

Availability
6.1.0
9.2.0
passwordValue :String

Value of the password text field inside the dialog.

Note that this property is only available if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.


# persistent

Availability
3.0.0
3.0.0
9.2.0
persistent :Boolean

Boolean value indicating if the alert dialog should only be cancelled by user gesture or by hide method.

This property is useful to ensure that the alert dialog will not be ignored by the user when the application is paused/suspended.

Default: false on iOS, true on Android


# placeholder DEPRECATED

Availability
5.1.0
9.2.0
placeholder :String

DEPRECATED SINCE 5.4.0

Use hintText instead.

Placeholder of the text field inside the dialog.

Note that this property is only available if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.


# preferred

Availability
6.0.0
9.2.0
preferred :Number

Index to define the preferred button.

When you specify a preferred action, the alert dialog highlights the text of that action to give it emphasis. (If the alert also contains a cancel button, the preferred action receives the highlighting instead of the cancel button.) If the iOS device is connected to a physical keyboard, pressing the Return key triggers the preferred action.

Note that this property is only available on iOS 9 or above.

Default: -1


# previewContext

Availability
5.1.0

The preview context used in the 3D-Touch feature "Peek and Pop".

Preview context to present the "Peek and Pop" of a view. Use an configured instance of Titanium.UI.iOS.PreviewContext here.

Note: This property can only be used on devices running iOS9 or later and supporting 3D-Touch. It is ignored on older devices and can manually be checked using forceTouchSupported.


# returnKeyType

Availability
5.1.0
9.2.0
returnKeyType :Number

Specifies the text to display on the keyboard Return key when this field is focused.

Note that this property is only available if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.

Default: Titanium.UI.RETURNKEY_DEFAULT


# rotation

Availability
5.4.0
12.3.0
rotation :Number

Clockwise 2D rotation of the view in degrees.

Translation values are applied to the static post layout value.


# rotationX

Availability
5.4.0
rotationX :Number

Clockwise rotation of the view in degrees (x-axis).

Translation values are applied to the static post layout value.


# rotationY

Availability
5.4.0
rotationY :Number

Clockwise rotation of the view in degrees (y-axis).

Translation values are applied to the static post layout value.


# scaleX

Availability
5.4.0
scaleX :Number

Scaling of the view in x-axis in pixels.

Translation values are applied to the static post layout value.


# scaleY

Availability
5.4.0
scaleY :Number

Scaling of the view in y-axis in pixels.

Translation values are applied to the static post layout value.


# severity

Availability
12.0.0
12.0.0
severity :Number

Indicates the severity of the alert in apps built with Mac Catalyst.

This property defines the severity options used by the severity property of UIAlertController. In apps built with Mac Catalyst, the severity determines the style of the presented alert. A ALERT_SEVERITY_CRITICAL alert appears with a caution icon, and an alert with a ALERT_SEVERITY_DEFAULT severity doesn’t. UIKit ignores the alert severity on iOS.

You should only use the ALERT_SEVERITY_CRITICAL severity if an alert truly requires special attention from the user.

For more information, see the Human Interface Guidelines on alerts.

Default: Titanium.UI.iOS.ALERT_SEVERITY_DEFAULT


# style

Availability
3.0.0
9.2.0
style :Number

The style for the alert dialog.

Style of the alert dialog, specified using one of the constants from Titanium.UI.iOS.AlertDialogStyle. Using styles other than default one can break your dialog layout if more than two buttons used. All styles can handle up to two buttons comfortably, except for default style can handle up to six buttons when title and message is empty or not given. Note that this property is only available on iOS SDK 5 or above.

Default: Titanium.UI.iOS.AlertDialogStyle.DEFAULT


# tintColor

Availability
6.2.0
9.2.0
tintColor :String | Titanium.UI.Color

The tint-color of the dialog.

This property is a direct correspondant of the tintColor property of UIView on iOS. For a dialog, it will tint the color of it's buttons. For information about color values, see the "Colors" section of Titanium.UI.

Default: null


# title

Availability
0.8
0.8
9.2.0
title :String

Title of the dialog.

If not set, a dialog with no title bar will be created.


# titleid

Availability
0.8
0.8
9.2.0
titleid :String

Key identifying a string in the locale file to use for the title text.


# tooltip

Availability
12.1.0
12.1.0
12.1.0
tooltip :String

The default text to display in the control's tooltip.

Assigning a value to this property causes the tool tip to be displayed for the view. Setting the property to null cancels the display of the tool tip for the view. Note: This property is only used for apps targeting macOS Catalyst.


# touchFeedback

Availability
6.1.0
touchFeedback :Boolean

A material design visual construct that provides an instantaneous visual confirmation of touch point.

Touch feedback is only applied to a view's background. It is never applied to the view's foreground content such as a Titanium.UI.ImageView's image.

For Titanium versions older than 9.1.0, touch feedback only works if you set the backgroundColor property to a non-transparent color.

Default: false


# touchFeedbackColor

Availability
6.1.0
touchFeedbackColor :String

Optional touch feedback ripple color. This has no effect unless touchFeedback is true.

Defaults to provided theme color.


# transitionName

Availability
5.0.2
transitionName :String

A name to identify this view in activity transition.

Name should be unique in the View hierarchy.


# translationX

Availability
5.0.0
translationX :Number

Horizontal location of the view relative to its left position in pixels.

Translation values are applied to the static post layout value.


# translationY

Availability
5.0.0
translationY :Number

Vertical location of the view relative to its top position in pixels.

Translation values are applied to the static post layout value.


# translationZ

Availability
5.0.0
translationZ :Number

Depth of the view relative to its elevation in pixels.

Translation values are applied to the static post layout value.


# value

Availability
6.1.0
9.2.0
value :String

Value of the text field inside the dialog.

Note that this property is only available if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.


# verticalMotionEffect

Availability
7.3.0
9.2.0
verticalMotionEffect :MinMaxOptions

Adds a vertical parallax effect to the view

Note that the parallax effect only happens by tilting the device so results can not be seen on Simulator. To clear all motion effects, use the <Titanium.UI.clearMotionEffects> method.

# Methods

# addEventListener

Availability
0.8
0.8
9.2.0
addEventListener(name, callback) → void

Adds the specified callback as an event listener for the named event.

Parameters

Name Type Description
name String

Name of the event.

callback Callback<Titanium.Event>

Callback function to invoke when the event is fired.

Returns

Type
void

# applyProperties

Availability
3.0.0
3.0.0
9.2.0
applyProperties(props) → void

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.

Parameters

Name Type Description
props Dictionary

A dictionary of properties to apply.

Returns

Type
void

# clearMotionEffects

Availability
8.2.0
9.2.0
clearMotionEffects() → void

Removes all previously added motion effects.

Use this method together with <Titanium.UI.horizontalMotionEffect> and <Titanium.UI.verticalMotionEffect>.

Returns

Type
void

# fireEvent

Availability
0.8
0.8
9.2.0
fireEvent(name[, event]) → void

Fires a synthesized event to any registered listeners.

Parameters

Name Type Description
name String

Name of the event.

event Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

Type
void

# getViewById

Availability
6.1.0
6.1.0
9.2.0
getViewById(id) → Titanium.UI.View

Returns the matching view of a given view ID.

Parameters

Name Type Description
id String

The ID of the view that should be returned. Use the id property in your views to enable it for indexing in this method.

Returns


# hide

Availability
0.9
0.9
9.2.0
hide([options]) → void

Hides this dialog.

Parameters

Name Type Description
options AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and used only on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

Returns

Type
void

# insertAt

Availability
3.3.0
3.3.0
9.2.0
insertAt(params) → void

Inserts a view at the specified position in the children array.

Useful if the layout property is set to horizontal or vertical.

Parameters

Name Type Description
params ViewPositionOptions

Pass an object that specifies the view to insert and optionally at which position (defaults to end)

Returns

Type
void

# removeEventListener

Availability
0.8
0.8
9.2.0
removeEventListener(name, callback) → void

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

Name Type Description
name String

Name of the event.

callback Callback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

Returns

Type
void

# replaceAt

Availability
3.3.0
3.3.0
9.2.0
replaceAt(params) → void

Replaces a view at the specified position in the children array.

Useful if the layout property is set to horizontal or vertical.

Parameters

Name Type Description
params ViewPositionOptions

Pass an object with the view to insert and the position of the view to replace. In this case the position property is required.

Returns

Type
void

# show

Availability
0.9
0.9
9.2.0
show([options]) → void

Shows this dialog.

Parameters

Name Type Description
options AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and only used on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

Returns

Type
void

# stopAnimation

Availability
12.1.0
stopAnimation() → void

Stops a running animation.

Stops a running view Titanium.UI.Animation.

Returns

Type
void

# Events

# click

Availability
0.9
0.9
9.2.0

Fired when a button in the dialog is clicked.

There is a subtle difference between singletap and click events.

A singletap event is generated when the user taps the screen briefly without moving their finger. This gesture will also generate a click event.

However, a click event can also be generated when the user touches, moves their finger, and then removes it from the screen.

On Android, a click event can also be generated by a trackball click.

Properties

Name Type Description
cancel Boolean | Number

Boolean type on Android; Number on iOS.

On Android, indicates whether the cancel button was clicked, in which case returns true.

On iOS, the value of the cancel property is returned, if defined, or -1 otherwise. Also note that the cancel button may not be used on the iPad, because iOS will internally decide whether or not to show it in the current context (e.g. in a popover).

See the Three-button Alert Dialog example for a cross-platform workaround for this parity issue.

index Number

Index of the button that was clicked.

login String

Value of login field if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

password String

Value of password field if dialog style property is defined as LOGIN_AND_PASSWORD_INPUT.

text String

Value of text field if dialog style property is defined as PLAIN_TEXT_INPUT or SECURE_TEXT_INPUT.

source Object

Source object that fired the event.

type String

Name of the event fired.

bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.