-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDonation.js
173 lines (155 loc) · 5.67 KB
/
Donation.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
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
173
import React, {Component} from 'react'
import {
View,
StyleSheet,
Text,
TouchableOpacity,
Image,
TextInput,
Dimensions
}from 'react-native'
import AsyncStorage from '@react-native-community/async-storage';
const width = Dimensions.get('window').width
export default class Donation extends Component{
state={
req: '',
hashtag: '',
info: ''
}
sendRequest = async() =>{
params={
name: 'Neel',
message: this.state.req,
category: this.state.hashtag,
username: 'iNeel18',
price: 20,
info: this.state.info,
type: 'donation'
}
const resp = await Parse.Cloud.run('AddRequest', params)
if(resp){
alert('Thank you for donation')
}
}
render(){
Parse.setAsyncStorage(AsyncStorage);
Parse.initialize("myAppId");
Parse.serverURL = 'http://localhost:1337/parse';
return(
<View style={{flex: 1}}>
<View style={{height: 50, marginLeft: 30, marginTop: 35, flexDirection: 'row', alignItems: 'center', width: phonewidth}}>
<View>
<Image
source={require('./images/circle.png')}
style={{width: 40, height: 40}}
/>
<Image
source={require('./images/avatar2.png')}
style={{ resizeMode: "cover",
height: 45,
width: 45,
borderWidth: 0,
borderRadius: 75,
position: 'absolute', top: -4, left: -4}}
/>
</View>
<View>
<Image
source={require('./images/weShare.png')}
style={{ width: 150, height: 30, marginLeft: 71}}
/>
</View>
<View>
<TouchableOpacity onPress={() => this.props.navigation.goBack()}>
<Image
source={require('./images/delete.png')}
style={{ width: 20, height: 20, marginLeft: 85}}
/>
</TouchableOpacity>
</View>
</View>
<View style={{flex: 1, alignItems: 'center'}}>
<Text style={styles.txt}>Donation Form</Text>
<Text style={styles.txt2}> What would you like to Donate?</Text>
<TextInput
placeholder='What would you like to donate?'
onChangeText={txt => this.setState({req: txt})}
value={this.state.req}
style={styles.txt3}/>
<Text style={styles.cat}> Category Hashtag #</Text>
<TextInput
placeholder='Type your category here'
onChangeText={txt => this.setState({hashtag: txt})}
value={this.state.hashtag}
style={styles.txt3}/>
<Text style={styles.cat}> Additional Information</Text>
<TextInput
placeholder='Additional Information'
onChangeText={txt => this.setState({ info: txt })}
value={this.state.info}
style={styles.txt3} />
<View style={{flex: 1, width: width, marginTop: 200, alignItems: 'center'}}>
<View style={{height: 50, backgroundColor: '#5887F9', alignItems: 'center', justifyContent: 'center', width: width}}>
<TouchableOpacity onPress={() => {
this.sendRequest()
this.setState({
req: '',
hashtag: '',
info: ''
})
this.props.navigation.replace('rfeed')
}}>
<Text style={styles.confirm2}>Confirm</Text>
</TouchableOpacity>
</View>
<Text style={styles.safe}>You are completely safe</Text>
<Text style={styles.safe2}>Read our Terms & Conditions</Text>
</View>
</View>
</View>
)
}
}
const styles= StyleSheet.create({
txt:{
fontWeight: '500',
color: '#5887F9',
fontSize: 20
},
txt2:{
marginTop: 48,
fontSize: 20,
fontWeight: '500',
color: '#5887F9'
},
txt3:{
height: 50,
marginTop: 20,
borderBottomWidth: 0.5,
borderColor: 'black',
width: 340
},
cat:{
fontSize: 20,
fontWeight: '500',
color: '#5887F9',
marginTop: 60
},
confirm2:{
fontSize: 12,
fontWeight: '500',
color: '#FFFFFF'
},
safe:{
fontWeight: '500',
fontSize: 15,
color: '#5F7FC1',
marginTop: 14
},
safe2:{
fontWeight: '500',
fontSize: 15,
color: '#CAA8FE',
marginTop: 7
}
})