-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPhotoReview.js
66 lines (59 loc) · 1.36 KB
/
PhotoReview.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
'use strict';
var React = require('react-native');
var {
StyleSheet,
Text,
TextInput,
View,
TouchableHighlight,
ActivityIndicatorIOS,
Image,
Component
} = React;
var Button = require('react-native-button');
var Form = require('./Form');
var PhotoReview = React.createClass({
statics: {
title: 'Review your picture'
},
render() {
return (
<View style={{flex: 1, alignItems: 'stretch'}}>
<Image style={{flex: 1}} source={{uri: this.props.photo, isStatic: true}} />
<Button style={{color: 'green', margin: 10}} onPress={this._submit}>
Save
</Button>
</View>
);
},
_submit() {
fetch(this.props.baseUrl + "/visits.json", {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
visit: {
host_slack_id: this.props.host,
visitor_attributes: {
first_name: this.props.firstName,
last_name: this.props.lastName,
photo: this.props.photo
}
}
})
})
.then((response) => {
// this.props.navigator.popToTop();
this.props.navigator.resetTo({
title: Form.title,
component: Form,
passProps: {
resetForm: true
}
});
});
}
});
module.exports = PhotoReview;