-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
172 lines (165 loc) · 3.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import React from 'react';
import {useState} from 'react';
import {
Text, //First letter Capital
View,
Button,
StyleSheet,
TextInput,
FlatList,
ScrollView,
} from 'react-native';
import CompanyData from './components/CompanyData';
export default App;
function App(): JSX.Element {
const fruit = val => {
console.warn(val);
};
//list with flat list component
const users = [
{
id: 1,
label: 'Digital Evangelist',
},
{
id: 2,
label: 'Web developer',
},
{
id: 3,
label: 'Traveller',
},
{
id: 4,
label: 'Digital Evangelist',
},
{
id: 5,
label: 'Web developer',
},
{
id: 6,
label: 'Traveller',
},
{
id: 7,
label: 'Traveller',
},
{
id: 8,
label: 'Digital Evangelist',
},
{
id: 9,
label: 'Web developer',
},
{
id: 10,
label: 'Traveller',
},
];
return (
<View>
<Text style={{fontSize: 30, color: 'red'}}>Hello, I am Ankush</Text>
<FlatList
data={users}
renderItem={({item}) => (
<Text style={{fontSize: 15}}>{item.label}</Text>
)}
/>
<Text style={styles.textBox}>Digital Evangelist </Text>
<Text style={styles.textBox}>BIKE RIDER</Text>
<Button
style={styles.textBox}
title="Press Here for more"
onPress={() => fruit('Thankyou for pressing')}></Button>
<UserData />
<CompanyData />
<User />
</View>
);
}
function User(): JSX.Element {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [display, setDisplay] = useState(false);
const resetFormData = () => {
setDisplay(false);
setEmail('');
setName('');
setPassword('');
};
return (
<View style={{backgroundColor: 'green', padding: 5}}>
<ScrollView>
<Text style={{fontSize: 30, textAlign: 'center'}}>
Login to my portal
</Text>
<TextInput
style={fostyles.textBox}
placeholder="Enter User Name"
onChangeText={text => setName(text)}
value={name}
/>
<TextInput
style={fostyles.textBox}
placeholder="Enter Your Password"
secureTextEntry={true}
onChangeText={text => setPassword(text)}
value={password}
/>
<TextInput
style={fostyles.textBox}
placeholder="Enter User Email"
onChangeText={text => setEmail(text)}
value={email}
/>
<View style={{marginBottom: 10}}>
<Button
color={'orange'}
title="Print Details"
onPress={() => setDisplay(true)}
/>
</View>
<Button title="Clear Details" onPress={resetFormData} />
<View>
{display ? (
<View>
<Text>User Name is :{name}</Text>
<Text>User Password is :{password}</Text>
<Text>User email is :{email}</Text>
</View>
) : null}
</View>
</ScrollView>
</View>
);
}
function UserData(): JSX.Element {
return <View></View>;
}
const styles = StyleSheet.create({
textBox: {
color: 'blue',
fontSize: 25,
backgroundColor: 'lightblue',
padding: 5,
borderRadius: 10,
height: 45,
borderWidth: 2,
textAlign: 'center',
},
});
const fostyles = StyleSheet.create({
textBox: {
color: 'blue',
fontSize: 18,
backgroundColor: 'lightblue',
padding: 5,
borderRadius: 10,
height: 45,
borderWidth: 2,
textAlign: 'center',
},
});