Created
December 28, 2018 20:41
-
-
Save abranhe/28252e60728a56feca8717bd9427c91d to your computer and use it in GitHub Desktop.
React Native Alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Alert, Text, TouchableOpacity, StyleSheet } from 'react-native' | |
const AlertExample = () => { | |
const showAlert = () =>{ | |
Alert.alert( | |
'You need to...' | |
) | |
} | |
return ( | |
<TouchableOpacity onPress = {showAlert} style = {styles.button}> | |
<Text>Alert</Text> | |
</TouchableOpacity> | |
) | |
} | |
export default AlertExample | |
const styles = StyleSheet.create ({ | |
button: { | |
backgroundColor: '#4ba37b', | |
width: 100, | |
borderRadius: 50, | |
alignItems: 'center', | |
marginTop: 100 | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import AlertExample from './AlertExample.js' | |
const App = () => { | |
return ( | |
<AlertExample /> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment