In this tutorial, we will learn how to add simple Alerts in React Native Application. Alerts are very important in app development because it could be used to output a warning or success message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import * as React from 'react'; import { Text, View, StyleSheet, Button } from 'react-native'; export default function App () { return ( <View style={styles.container}> <Text> SIMPLE ALERTS </Text> <Button onPress={() => { alert('I LOVE JESUS!!!'); }} title="CLICK" /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, }); |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.