Hai i am trying to show alert message, i tried different ways like alert,AlertIOS,Alert.alert
Alert.alert('Alert', 'email is not valid, Please enter correct email', [{text: 'Ok'}]);
I got an error like this:
Any one give suggestions that how to show the alert in Android and IOS in react-native Any help much appreciated
The Alert API efficiently works on both iOS and Android and can show static alerts. React Native offers three types of Alert dialog, and those are Simple Alert, Two Options Alert, and Three Options Alert.
Show some messageshowMessage({ message: "Hello World", description: "This is our second message", type: "success", }); The type attribute set the type and color of your flash message, default options are "success" (green), "warning" (orange), "danger" (red), "info" (blue) and "default" (gray).
Are you sure you are including it from the correct path? I get the same error when I imported Alert from react library and NOT react-native.
so the working thingie is:
import React, { Component } from 'react';
import { View, Alert } from 'react-native';
and the non-working one was:
import React, { Component, Alert } from 'react';
import { View } from 'react-native';
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