I cannot set the title of an Alert box with React-Native
import React, { Component } from 'react';
import ReactNative,{
StyleSheet,
Text,
View,
Alert,
} from 'react-native';
...
alert("myTitle","my message");
Title shows as "Alert" instead of as "myTitle"
Alerts on Android can be dismissed by tapping outside of the alert box. It is disabled by default and can be enabled by providing an optional Options parameter with the cancelable property set to true i.e. { cancelable: true } .
The Alert component helps to show a dialog box i.e., a pop up to the user with a title, message, buttons to know the confirmation from the user based on the message displayed. import { Alert } from 'react-native'; To get the pop-up you just have to call the Alert. alert() function.
The syntax is different:
Alert.alert("myTitle", "my message");
Reference: http://facebook.github.io/react-native/docs/alert.html#examples
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With