-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
70 lines (68 loc) · 1.72 KB
/
App.js
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
import { StatusBar } from "expo-status-bar";
import { SafeAreaView, StyleSheet, View } from "react-native";
import ImageProvide from "./src/ImageProvide";
import CustomTextInput from "./src/style/CustomTextInput";
import { useState } from "react";
export default function App() {
const [formData, setFormData] = useState({
subject: "",
price: "",
weight: "",
});
const handleInputChange = (key, value) => {
setFormData({ ...formData, [key]: value });
};
return (
<SafeAreaView style={styles.container}>
<CustomTextInput
placeholder="Enter subject"
target="subject"
formData={formData}
handleInputChange={handleInputChange}
/>
<View style={styles.twoInputContainer}>
<CustomTextInput
placeholder="Enter price"
keyboardType="numeric"
target="price"
formData={formData}
handleInputChange={handleInputChange}
style={styles.twoInput}
/>
<CustomTextInput
placeholder="Enter weight"
keyboardType="numeric"
target="weight"
formData={formData}
handleInputChange={handleInputChange}
style={styles.twoInput}
/>
</View>
<ImageProvide
subject={formData.subject}
price={formData.price}
weight={formData.weight}
/>
<StatusBar style="auto" />
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
margin: 30,
},
twoInputContainer: {
flexDirection: "row",
marginBottom: 40,
marginTop: 10,
gap: 6,
},
twoInput: {
width: "50%",
margin: 0,
justifyContent: "center",
alignItems: "center",
},
});