-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewMoment.js
93 lines (87 loc) · 2.43 KB
/
ViewMoment.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
import React, { Component } from 'react';
import { StyleSheet, Text, Image, View, Button } from 'react-native';
import { Ionicons , FontAwesome} from '@expo/vector-icons';
import NavigationBar from 'react-native-navbar';
import { Analytics, ScreenHit } from 'expo-analytics';
class ViewMoment extends React.Component {
constructor() {
super()
global.analytics.hit(new ScreenHit('ViewMoment'))
.then(() => console.log("success"))
.catch(e => console.log(e.message));
}
static navigationOptions = {
header: null,
gesturesEnabled: false,
};
render() {
const { params } = this.props.navigation.state;
const id = params ? params.id : null;
const title = params ? params.title : null;
const time = params ? params.time : null;
const description = params ? params.description : null;
const imageUrl = params ? params.imageUrl : null;
console.log(params);
return (
<View style = {styles.navbarContainer}>
<NavigationBar
rightButton = {{
title: 'Edit',
handler: () => {
this.props.navigation.navigate('EditMoment', {
id: id,
title: title,
time: time,
description: description,
imageUrl: imageUrl,
});
},
}}
leftButton = {{
title: 'Back',
handler: () => {this.props.navigation.navigate('Home');},
}}
/>
<View style = {styles.momentContainer}>
<Text style = {styles.momentTitleText}>{title}</Text>
<Text>{time}</Text>
<Text style = {styles.momentDescriptionText}>{description}</Text>
<View style = {styles.imageGrid}>
{imageUrl && <Image source={{ uri: imageUrl }} style={styles.momentImage} />}
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
momentTitleText: {
fontSize: 40,
},
momentDescriptionText: {
paddingTop: 20,
},
momentContainer: {
backgroundColor: 'white',
paddingHorizontal: 20,
paddingTop: 10,
flex: 1,
},
navbarContainer: {
flex: 1,
backgroundColor: 'white',
paddingHorizontal: 10,
paddingTop: 28,
},
imageGrid: {
flexDirection: 'row',
paddingTop: 50,
alignSelf: 'flex-start',
justifyContent: 'center',
},
momentImage: {
width: 400,
height: 400,
},
});
export default ViewMoment;