-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
96 lines (84 loc) · 1.95 KB
/
App.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
/**
* Código base App.js para el examen
*/
import React, { Component } from 'react';
import { StyleSheet, View, Text, ScrollView } from 'react-native';
import { MiElemento } from './components/MiElemento';
import { ElTotal } from './components/ElTotal';
import { Autor } from './components/Autor';
const ejercicio1 = {
name: 'Cereales con chocolate',
description: 'Cereales rellenos de chocolate',
quantity: 2,
category: 'Cereales',
price: 5,
}
const listaItems = [{
name: 'Cereales con chocolate',
description: 'Cereales rellenos de chocolate',
quantity: 2,
category: 'Cereales',
price: 2,
},
{
name: 'Hamburguesa de pavo',
description: 'Hamburguesa buena y saludable',
quantity: 4,
category: 'Carne',
price: 3,
},
{
name: 'Agua mineral',
description: 'Agua de un manantial del Himalaya',
quantity: 3,
category: 'Bebidas',
price: 3,
}]
export class App extends Component {
render() {
return (
<View style={styles.container}>
<View>
<Text style={styles.seccionTitulo}>Listado:</Text>
</View>
{/* <MiElemento item={ejercicio1}></MiElemento> */}
<ScrollView>
{listaItems.map((item, pos) => {
return (
<View key={pos}>
<MiElemento item={item}></MiElemento>
</View>
);
})}
</ScrollView>
<View>
<ElTotal lista={listaItems}></ElTotal>
</View>
<View style={styles.componenteAutor}>
<Autor color='white' nombre='Alejandro García Cuesta'></Autor>
</View>
</View>
);
}
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 10,
backgroundColor: 'green',
},
seccionTitulo: {
color: 'black',
},
componenteMiElemento: {
},
componenteElTotal: {
},
componenteAutor: {
flexDirection: 'row',
marginBottom: 200,
marginTop: 10,
justifyContent: 'flex-end',
}
});
export default App;