React Native Alert

 App.js:


import React from 'react';
import { StyleSheet,  View, Button, Alert } from 'react-native';


const App = () => {
    return (
        <View style={{ flex: 1 }}>

            <View>
                <Button title="Single Alert" onPress={() => alert('Alert Tutorial by Krishan')}/>
            </View>

            <View style={{marginTop:10}}>
                <Button title='Two Alert' onPress={() => Alert.alert('Alert Title', "Alert Description", [
                    {
                        text:'Yes',
                        onPress:()=>console.log('Yes Pressed !')
                    },
                    {
                        text:'No',
                        onPress:()=>console.log('No Pressed !')
                    }

                ])}/>
            </View>

            <View style={{marginTop:10}}>
                <Button title='Three Alert' onPress={() => Alert.alert('Alert Title', "Alert Description", [
                    {
                        text:'Yes',
                        onPress:()=>console.log('Yes Pressed !')
                    },
                    {
                        text:'No',
                        onPress:()=>console.log('No Pressed !')
                    },
                    {
                        text:'May be Later',
                        onPress:()=>console.log('May be later Pressed !')
                    }

                ])}/>
            </View>

        </View>

    )
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    }
})
export default App;






Comments

Popular posts from this blog

Send Data Child to Parent Component - React Js

Hide , Show and Toggle in ReactJs

Importance Of Web Content In SEO.