React Native - Alert
React Native - Alert
In this chapter, we will understand how to create custom Alert component.
Step 1: App.js
import React from 'react' import AlertExample from './alert_example.js' const App = () => { return () } export default App
Step 2: alert_example.js
We will create a button for triggering the showAlert function.
import React from 'react' import { Alert, Text, TouchableOpacity, StyleSheet } from 'react-native' const AlertExample = () => { const showAlert = () =>{ Alert.alert( 'You need to...' ) } return () } export default AlertExample const styles = StyleSheet.create ({ button: { backgroundColor: '#4ba37b', width: 100, borderRadius: 50, alignItems: 'center', marginTop: 100 } }) Alert
Output
Frequently Asked Questions
+
Ans: React Native - Text view more..
+
Ans: React Native - Picker view more..
+
Ans: React Native - ActivityIndicator view more..
+
Ans: React Native - Alert view more..
Recommended Posts:
- React Native Tutorial
- React Native - Overview
- React Native - Environment Setup
- React Native - App
- React Native - State
- React Native - Props
- React Native - Styling
- React Native - FlexboxReact Native - Flexbox
- React Native - FlexboxReact Native - Flexbox
- React Native - ListView
- React Native - Text Input
- React Native - ScrollView
- React Native - Images
- React Native - HTTP
- React Native - Buttons
Rating - NAN/5
Advertisements