-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfileScreen.js
More file actions
159 lines (136 loc) · 3.86 KB
/
ProfileScreen.js
File metadata and controls
159 lines (136 loc) · 3.86 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
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
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { StyleSheet, View, Button, Text, TouchableOpacity, Alert, Image, ImageBackground } from 'react-native';
import React, { Component } from 'react';
import { TextInput } from 'react-native-gesture-handler';
import { placeholder } from '@babel/types';
export default class ProfileScreen extends React.Component {
constructor() {
super()
this.state = {
username: "",
password: ""
}
}
static navigationOptions = {
title: 'Login',
};
handleUserName = (newtext) => {
this.setState({
username: newtext
})
}
handlePassword = (typedtext) => {
this.setState({
password: typedtext
})
}
handlebuttonpress = () => {
if (this.state.username === "abdullah" && this.state.password === "abdullah1234") {
//const {navigate} = this.props.navigation;
// navigate('Home', {name: 'Jane'} )
this.props.navigation.navigate('Home', { name: 'abdullah' })
Alert.alert('Login success')
}
else {
Alert.alert('WRONG USER NAME OR PASSWORD PLEASE try AGAIN')
}
}
render() {
const {navigate} = this.props.navigation;
return (
<ImageBackground style={{
// flex: 1,
// alignSelf: 'stretch',
height:'100%',
width:'100%',
position:'absolute',
top:0
}}
source={require('./assests/background.png')}
>
<View style={styles.container}>
<View style={styles.inputv}>
<Text style={styles.TextStyless}>
Username
</Text>
<TextInput
style={styles.InputBOX}
placeholder='Username'
placeholderTextColor='red'
onChangeText={this.handleUserName}
/>
<Text style={{ color: 'blue', fontSize: 20 }}>
Password
</Text>
<TextInput
secureTextEntry={true}
style={styles.InputBOX}
onChangeText={this.handlePassword}
placeholder='password'
placeholderTextColor='red'
/>
<Button
style={styles.loginbuttonStyle}
title="Go to Ali's profile"
onPress={this.handlebuttonpress}
/>
<TouchableOpacity activeOpacity={0.5} style={{marginTop: 15}} onPress={() => navigate('signup', {name: 'signup'})}>
<View>
<Text style={styles.forgottextstyle}>
SIGN UP
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5} style={{marginTop: 10}} onPress={()=> Alert.alert('New password have been send to your mail') }>
<View>
<Text style={styles.forgottextstyle}>
forgort password ?
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5} style={{marginTop: 15}} onPress={() => navigate('mainScreen', {name: 'main'})}>
<View>
<Text style={styles.forgottextstyle}>
NOT NOW
</Text>
</View>
</TouchableOpacity>
</View>
</View>
</ImageBackground>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 50,
justifyContent:'space-between'
},
TextStyless: {
fontSize: 20,
color: 'blue'
},
InputBOX: {
height: 40,
borderColor: 'gray',
borderWidth: 1,
marginBottom: 30,
color: 'red'
},
inputv: {
// marginTop: 300
},
loginbuttonStyle:{
// alignItems:'center',
marginLeft:30,
marginRight:30,
backgroundColor:'red'
// width:50,
},
forgottextstyle:{
color:'red',
backgroundColor:'transparent',
textAlign:'center'
}
})