Advertisement
zidniryi

App.js

Jun 19th, 2020
2,994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {useState} from 'react'
  2. import { View, Text, TextInput, TouchableOpacity, StyleSheet, Alert} from 'react-native'
  3.  
  4. export default function App() {
  5.   const [name, setname] = useState('')
  6.   return (
  7.     <View style={styles.container}>
  8.       <Text>Absen Nama :</Text>
  9.       <TextInput
  10.         testID='input-name'
  11.         onChangeText={name => setname(name)}
  12.         style={styles.input}
  13.         placeholder={'Name'}
  14.         value={name}
  15.       />
  16.       <TouchableOpacity
  17.         testID={'button-absen'}
  18.         onPress={() => Alert.alert('nama',name)}>
  19.         <View style={styles.button}>
  20.           <Text style={styles.textButton}>Absen</Text>
  21.         </View>
  22.       </TouchableOpacity>
  23.      
  24.     </View>
  25.   )
  26. }
  27.  
  28. const styles = StyleSheet.create({
  29.   container:{
  30.     flex:1,
  31.     backgroundColor:'#fff',
  32.     justifyContent:'center',
  33.     marginHorizontal:20
  34.   },
  35.   input:{
  36.     width: 300,
  37.     height:40,
  38.     borderWidth:1,
  39.     borderColor:'#DDD',
  40.     borderRadius:5,
  41.     marginTop:10
  42.   },
  43.   button:{
  44.     width: 300,
  45.     height:45,
  46.     borderWidth:1,
  47.     borderColor:'#DDD',
  48.     backgroundColor:'#1B1B32',
  49.     borderRadius:5,
  50.     marginTop:10,
  51.     justifyContent:'center',
  52.     alignItems:'center'
  53.   },
  54.   textButton:{
  55.     fontWeight:'bold',
  56.     color:'#FFF'
  57.   }
  58. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement