-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
162 lines (154 loc) · 3.89 KB
/
App.js
File metadata and controls
162 lines (154 loc) · 3.89 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
160
161
162
import React, { Component } from 'react';
import {
Modal,
WebView,
Platform,
Button,
StyleSheet,
Text,
TextInput,
View,
AsyncStorage,
TouchableOpacity,
} from 'react-native';
import {
createAppContainer,
createStackNavigator,
StackActions,
NavigationActions,
} from 'react-navigation';
import {styles} from './styles';
import adminpage from './Admin'
import forgetpassword from './forgetpassword'
import viewmoneyrequestpage from './Viewmoney'
import viewprojectrequestpage from './Viewproject'
import loginform from './Loginforms'
import options from './opti'
import {bank,project} from './newprojectfordonation'
import {Decker,paytm} from './decker'
import owndecker from './owndecker'
// type Props = {};
export class signupform extends React.Component {
constructor(props) {
super(props);
this.state = { phoneno: '', password: '', email: '' ,donatedamount: 0};
}
async newUser(data) {
try {
let response = await fetch('http://ec2-3-14-86-69.us-east-2.compute.amazonaws.com/users', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
let responseJson = await response.json();
return responseJson;
} catch (error) {
console.log(error);
}
}
render() {
return (
<View style={styles.container}>
<View style={styles.innerContainer}>
<Text style={styles.header}>Sign Up</Text>
<TextInput
style={styles.textinput}
placeholder="Your Phone No."
underlineColorAndroid={'transparent'}
onChangeText={phoneno => this.setState({ phoneno })}
/>
<TextInput
style={styles.textinput}
placeholder="Your email"
underlineColorAndroid={'transparent'}
onChangeText={email => this.setState({ email })}
/>
<TextInput
style={styles.textinput}
placeholder="Your Password"
secureTextEntry={true}
underlineColorAndroid={'transparent'}
onChangeText={password => this.setState({ password })}
/>
<TouchableOpacity
style={styles.button}
onPress={async () => {
try {
let status = await this.newUser(this.state);
if (status.val == 'emailsent') {
alert('A link has been sent to your mail please verify');
this.props.navigation.navigate('login');
} else if (status.val == 'alreadyemail') {
alert('Email already exists.');
} else if (status.val == 'dataincomplete') {
alert('Please fill all fields correct.');
}
} catch (err) {
console.log(err);
}
}}>
<Text style={styles.btntext}>Sign Up</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
const AppNavigator = createStackNavigator(
{
login: {
screen: loginform,
},
signup: {
screen: signupform,
},
admin: {
screen: adminpage,
},
viewmoneyrequest: {
screen: viewmoneyrequestpage,
},
viewprojectrequest: {
screen: viewprojectrequestpage,
},
option: {
screen: options,
},
proj: {
screen : project,
},
ban: {
screen : bank
},
pay: {
screen : paytm
},
deck: {
screen : Decker
},
owndeck: {
screen : owndecker
},
forgetpasswords: {
screen : forgetpassword
},
},
{
initialRouteName: 'login',
defaultNavigationOptions: {
headerStyle: {
backgroundColor: '#001f61',
// height:10,
},
headerTintColor: '#fff',
title:"Bridging Funds",
headerTitleStyle: {
fontWeight: 'bold',
},
},
}
);
export default createAppContainer(AppNavigator);