Alert
Official documentation This module below has been implemented but not properly documented. You may find below partial documentation or just raw code to show you requirements for its usage.
If you want you can help us to improve the situation by editing this file.
Launches an alert dialog with the specified title
and 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.
open ReactNative;
Alert.alert(
~title="Do you really want to quit?",
~message="We miss you already.",
~buttons=[|
Alert.button(~text="OK", ~style=`destructive, ~onPress={() => Js.log("Bye!")}, ()),
Alert.button(~text="Cancel", ~style=`cancel, ()),
|],
~options=Alert.options(~cancelable=true, ~onDismiss={_ => Js.log("Dismissed.")}, ()),
(),
);