Skip to content

Instantly share code, notes, and snippets.

@karanjagota
Last active October 23, 2020 14:11
Show Gist options
  • Save karanjagota/e715541a19d4d2437382c547fdc2a2a6 to your computer and use it in GitHub Desktop.
Save karanjagota/e715541a19d4d2437382c547fdc2a2a6 to your computer and use it in GitHub Desktop.
import React from 'react';
import { StyleSheet,View,Button, Alert, Platform, ToastAndroid, TextInput } from 'react-native';
export default function App() {
const showalert = ()=>{ Alert.alert('Alert Component','You Pressed Alert Button!')}
const showtoast = ()=>{ if(Platform.OS=="android")ToastAndroid.show('You Pressed ToastMessage',ToastAndroid.SHORT)}
return (
<View>
<Button
style = {styles.button}
onPress={showalert}
title="Button For Alert" />
<Button
style = {styles.button}
onPress={showtoast}
title="Button For Toast" />
<TextInput
style={styles.tinput}
placeholder="This is a Text Input Component!" />
</View>
);
}
const styles = StyleSheet.create({
button:{padding:10,marginBottom:10,backgroundColor:"#F9A826",color:"#ffffff" },
tinput:{ padding:10, marginBottom:5,fontSize:15 }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment