Module Alert-BsReactNative

type type_ = [
| `default
| `loginPassword
| `plainText
| `secureText
];

Launches an alert dialog with the specified title and message.

Optionally provide a list of buttons. Tapping any button will fire the respective onPress callback and dismiss the alert. By default, the only button will be an 'OK' button.

This is an API that works both on iOS and Android and can show static alerts. To show an alert that prompts the user to enter some information, see AlertIOS; entering text in an alert is common on iOS only.

You can read more on Alert API usage in official docs: https://facebook.github.io/react-native/docs/alert

Example of use

  Alert.alert(
  ~title="This is an alert",
  ~message="Do something about it",
  ~type_=`secureText,
  ~buttons=[
    {
      text: Some("Something bad will happen"),
      onPress: Some(() => Js.log("Bad happened")),
      style: Some(`destructive),
    },
  ],
  (),
);

Function parameters

title
~title: string 
message
~message: string=?
button
~buttons: list(button)=?

reference:

type button = {
  text: option(string),
  onPress: option((unit => unit)),
  style: option([ | `cancel | `default | `destructive])
};
options
~options: options=?

reference:

type options = {
  cancelable: option(bool),
  onDismiss: option((unit => unit))
}
type_
type type_ = [ | `default | `loginPassword | `plainText | `secureText];
non-labeled argument
unit 
type options = {
cancelable: option(bool),
onDismiss: option((unit => unit)),
};
type button = {
text: option(string),
onPress: option((unit => unit)),
style: option([ `cancel | `default | `destructive ]),
};
let alert: title:string => ?⁠message:string => ?⁠buttons:list(button) => ?⁠options:options => ?⁠type_:[< `default | `loginPassword | `plainText | `secureText ] => unit => unit;