Since

0.1

AlertView is an alert box with buttons having custom behaviors. You can use AlertView for informing user or asking for confirmations. AlertView has buttons with callbacks that you can take action for each of them separately.

Example

import AlertView from '@smartface/native/ui/alertview';

const myAlertView = new AlertView({
title: "Alert Title",
message: "Alert Message"
});
myAlertView.addButton({
type: AlertView.Android.ButtonType.NEGATIVE,
text: "Cancel"
});
myAlertView.addButton({
type: AlertView.Android.ButtonType.POSITIVE,
text: "Okay",
onClick: () => {
console.log("Okay clicked.");
}
});

myAlertView.show();

Hierarchy

Implements

Properties

_nativeObject: any
title: string

Gets/sets title of AlertView.

Android

Ios

Since

0.1

message: string

Gets/sets message of AlertView.

Android

Ios

Since

0.1

onDismiss: ((alertView?: IAlertView) => void)

Type declaration

Android: { ButtonType: typeof ButtonType }

Type declaration

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get ios(): TProps["ios"]
  • Returns TProps["ios"]

  • get android(): TProps["android"]
  • Returns TProps["android"]

  • get textBoxes(): { text: string }[]
  • Returns object which contains text of added TextBox

    Android

    Ios

    Since

    4.1.2

    Returns { text: string }[]

Methods

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Parameters

    Returns void

  • Parameters

    • props: Partial<{}>

    Returns void

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns any

  • Gets showing status of AlertView. It is set to true if AlertView is currently displayed on screen, false otherwise.

    Property

    Android

    Ios

    Since

    0.1

    Returns void

  • Shows AlertView on the screen with specified properties, isShowing property set to true after this operation.

    Method

    show

    Android

    Ios

    Since

    0.1

    Returns void

  • Dismisses the AlertView, isShowing property set to false after this operation.

    Android

    Ios

    Since

    0.1

    Returns void

  • Returns string

  • Allows you to add button to AlertView. You can add maximum 3 buttons on Android platform, on iOS there is no limitation.

    Example

    myAlertView.addButton({
    type: AlertView.Android.ButtonType.POSITIVE,
    text: "Okay",
    onClick: function() {
    console.log("Okay clicked.");
    }
    });

    Android

    Ios

    Since

    0.1

    Parameters

    • params: { type: ButtonType; text: string; onClick?: (() => void); index?: number }
      • type: ButtonType
      • text: string
      • Optional onClick?: (() => void)
          • (): void
          • Returns void

      • Optional index?: number

    Returns void

  • Allows to add TextBox to AlertView. In iOS, maximum two textbox can be added. It is not applied to Android but 2 textboxes recommended.

    Example

    myAlertView.addTextBox({
    text: "Hello!",
    hint: "Hint!",
    isPassword: false,
    android: {
    viewSpacings: { left: 50, right: 50 }
    }
    });

    Android

    Ios

    Since

    4.1.2

    Parameters

    • params: { text: string; hint: string; isPassword: boolean; keyboardType?: number; android: Partial<{ width: number; height: number; viewSpacings: { left: number; top: number; right: number; bottom: number } }> }
      • text: string
      • hint: string
      • isPassword: boolean
      • Optional keyboardType?: number
      • android: Partial<{ width: number; height: number; viewSpacings: { left: number; top: number; right: number; bottom: number } }>

    Returns void

Constructors

  • Parameters

    Returns Alertview

Generated using TypeDoc