GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ReScript React Native
  • Docs
  • Components
  • APIs
  • Blog
  • GitHub
  • AccessibilityInfo
  • ActionSheetIOS
  • Alert
  • Animated
  • AnimationFrame
  • AppRegistry
  • AppState
  • BackHandler

This view

  • Original page
  • New address

GeezerVison is showing rescript-react-native.github.io — Alert | ReScript React Native

Types​

type style = [#default | #cancel | #destructive]

type button = {
text?: string,
onPress?: unit => unit,
style?: style,
isPreferred?: bool,
}

type options = {
cancelable?: bool,
userInterfaceStyle?: Appearance.t,
onDismiss?: unit => unit,
}

Methods​

alert​

Launches an alert dialog with the specified title and optional message. Optionally, an array of buttons can be provided: on Android the maximum is 3, on iOS any number is okay.

On Android, the dialog can be dismissed by tapping outside of the alert box. This triggers the onDismiss callback available in the options. With the cancelable option, this behavior can be deactivated altogether.

alert: (
~title: string,
~message: string=?,
~buttons: array<button>=?,
~options: options=?,
) => unit

Example​

open ReactNative

Alert.alert(
~title="Do you really want to quit?",
~message="We miss you already.",
~buttons=[
{text: "OK", style: #destructive, onPress: () => Console.log("Bye!")},
{text: "Cancel", style: #cancel},
],
~options={cancelable: true, onDismiss: () => Console.log("Dismissed.")},
)

prompt​

iOS only — prompt the user for text input.

prompt: (
~title: string,
~message: string=?,
~callbackOrButtons: [
| #callback(string => unit)
| #buttons(array<button>)
]=?,
~type_: [#default | #"plain-text" | #"secure-text" | #"login-password"]=?,
~defaultValue: string=?,
~keyboardType: string=?,
~options: options=?,
) => unit
  • Types
  • Methods
    • alert
    • prompt
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.