-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
81 lines (67 loc) · 2.64 KB
/
App.tsx
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { StatusBar } from 'expo-status-bar';
import { useState } from 'react';
import { StyleSheet, Text, View, Button, Alert, TextInput } from 'react-native';
export default function App() {
let [count , setCount] = useState(0);
let [input , setInput] = useState('');
return (
<View style={styles.container}>
<Text style={styles.teststyle}>{input}</Text>
<View style={styles.buttonContainer}>
<Button title = "7 " color = "green" onPress={()=>setInput(input + "7") } />
<Button title = "8 " color="blue" onPress={()=>setInput(input + "8")}/>
<Button title = "9 " color="purple" onPress={()=>setInput(input + "9")}/>
</View>
<View style={styles.buttonContainer}>
<Button title = "4 " color = "green" onPress={()=>setInput(input + "4")}/>
<Button title = "5 " color="blue" onPress={()=>setInput(input + "5")}/>
<Button title = "6 " color="purple" onPress={()=>setInput(input + "6")}/>
</View>
<View style={styles.buttonContainer}>
<Button title = "1 " color = "green" onPress={()=>setInput(input + "1")}/>
<Button title = "2 " color="blue" onPress={()=>setInput(input + "2")}/>
<Button title = "3 " color="purple" onPress={()=>setInput(input + "3")}/>
</View>
<View style={styles.buttonContainer}>
<Button title = "+ " color = "green" onPress={()=>setInput(input + "+")}/>
<Button title = "- " color="blue" onPress={()=>setInput(input + "-")}/>
<Button title = "= " color="purple" onPress={()=>setInput(eval(input.toString()))}/>
</View>
<View style={styles.buttonContainer}>
<Button title = "* " color = "green" onPress={()=>setInput(input + "*")}/>
<Button title = "/ " color="blue" onPress={()=>setInput(input + "/")}/>
<Button title = "C " color="purple" onPress={()=>setInput("")} />
</View>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 3,
backgroundColor: 'grey',
alignItems: 'center',
justifyContent: 'center',
},
teststyle: {
color: 'black',
fontSize : 65
},
inputstyle: {
backgroundColor : "red",
fontSize : 20,
width : 300,
height: 50,
},
buttonContainer : {
flexDirection : "row",
justifyContent : "center" ,
width: 200,
height: 100,
padding : 5,
},
button : {
width : 20,
height : 30,
}
});