-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (55 loc) · 1.15 KB
/
App.js
File metadata and controls
61 lines (55 loc) · 1.15 KB
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
import { StatusBar } from 'expo-status-bar';
import React, { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Input from './Input';
import Output from './Output';
export default function App() {
const info = [
{
id: 1,
name: "Name",
value: "",
}, {
id: 2,
name: "Email",
value: "",
}, {
id: 3,
name: "Phone",
value: "",
}
];
const [appInfo, setInfo] = useState(info);
const handleChange = (info, word) => {
const updatedInfo = appInfo.map(
i => {
if (info.id === i.id) {
i.value = word;
}
return i;
}
)
setInfo(updatedInfo);
};
return (
<View style={styles.container}>
<Text style={styles.text}>CPAN 213 - Lab 2</Text>
<Input info={appInfo} handleChange={handleChange}/>
<Output info={appInfo}/>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'aliceblue',
padding: 10,
},
text: {
fontSize: 20,
paddingTop: 200,
fontWeight: 'bold',
textAlign: 'center',
}
});