-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
51 lines (47 loc) · 1.1 KB
/
App.js
File metadata and controls
51 lines (47 loc) · 1.1 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
import React, { useState } from "react";
import { View, Text, StyleSheet, TextInput } from "react-native";
import MyButton from "./src/components/MyButton";
const App = () => {
const [text, setText] = useState("");
const [boolean, setBoolean] = useState(false);
return (
<>
{boolean && <Text style={styles.title}>useState Example</Text>}
<View style={styles.container}>
<Text style={styles.text}>Message: {text}</Text>
<TextInput
style={styles.input}
placeholder="Message"
value={text}
onChangeText={(value) => setText(value)}
/>
<MyButton setState={setBoolean} />
</View>
</>
);
};
const styles = StyleSheet.create({
title: {
fontSize: 30,
fontWeight: "bold",
alignSelf: "center",
marginTop: 50,
},
text: {
fontSize: 20,
},
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
input: {
backgroundColor: "#e7e7e7",
padding: 10,
borderRadius: 10,
fontSize: 25,
marginVertical: 10,
width: "80%",
},
});
export default App;