This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPokemonScreen.js
115 lines (108 loc) · 2.61 KB
/
PokemonScreen.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
'use strict';
var React = require('react-native');
var {
Image,
PixelRatio,
ScrollView,
StyleSheet,
Text,
View,
} = React;
var getImageSource = require('./getImageSource');
var PokemonCell = require('./PokemonCell');
var PokemonType = require('./PokemonType');
var PokemonScreen = React.createClass({
render: function() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
<Image
source={getImageSource(this.props.pokemon, false)}
style={styles.detailsImage}
/>
<View style={styles.rightPane}>
<Text style={styles.pokemonName}>{this.props.pokemon.name}</Text>
<PokemonType types={this.props.pokemon.types} />
<View>
<View style={styles.caract}>
<Text style={styles.caractTitle}>Height:</Text>
<Text style={styles.caractValue}>
{this.props.pokemon.height/10}m
</Text>
</View>
<View style={styles.caract}>
<Text style={styles.caractTitle}>Weigth:</Text>
<Text style={styles.caractValue}>
{this.props.pokemon.weight/10}kg
</Text>
</View>
</View>
</View>
</View>
<View style={styles.separator} />
<Text>
{this.props.pokemon.description}
</Text>
<View style={styles.separator} />
<Evolution evolutions={this.props.pokemon.evolutions} />
</ScrollView>
);
},
});
var Evolution = React.createClass({
render: function() {
if (!this.props.evolutions || !this.props.evolutions[0]) {
return null;
}
return (
<View>
<Text style={styles.evolution}>Evolution</Text>
{this.props.evolutions.map(pok =>
<PokemonCell pokemon={pok} />
)}
</View>
);
},
});
var styles = StyleSheet.create({
contentContainer: {
padding: 10,
},
rightPane: {
justifyContent: 'space-between',
flex: 1,
},
pokemonName: {
flex: 1,
fontSize: 20,
fontWeight: '500',
},
caract: {
marginTop: 5,
},
caractTitle: {
fontSize: 14,
},
caractValue: {
fontSize: 18,
fontWeight: '500',
},
mainSection: {
flexDirection: 'row',
},
detailsImage: {
width: 150,
height: 150,
marginRight: 10,
},
separator: {
backgroundColor: 'rgba(0, 0, 0, 0.1)',
height: 1 / PixelRatio.get(),
marginVertical: 10,
},
evolution: {
fontWeight: '500',
marginBottom: 3,
},
});
module.exports = PokemonScreen;