David 9 năm trước cách đây
mục cha
commit
9cc7f4b7ae

+ 1 - 0
src/actions/CursadaActions.js

@@ -21,6 +21,7 @@ export const cursadasFetch = () => {
 			});
 		})
 		.catch((error) => {
+			console.log(error);
 			dispatch({ type: CURSADAS_FETCH_FAIL, payload: error });
 		});
 	};

+ 6 - 1
src/actions/LocalStorageActions.js

@@ -7,16 +7,20 @@ import {
 const ls = require('react-native-local-storage');
 
 export const saveClase = ({ clase }) => {
+	console.log("saving:", clase);
 	//_id, profesor, texto, titulo, fecha
 	return (dispatch) => {
 		ls.get('clases').then((data) => {
+			console.log("clases get!", data);
 			ls.save('clases', [...data, clase]).then(() => {
 				dispatch({
 					type: LS_CLASE_SAVE,
 					payload: clase
 				});
 			});
-		});
+		}).catch((error) => {
+				console.log("error?", error);
+		}) ;
 	};
 };
 
@@ -42,6 +46,7 @@ export const initLSClase = () => {
 			let payload = data;
 			if (data === null || data === undefined) {
 				payload = [];
+				ls.save('clases', payload);
 			}
 
 			dispatch({

+ 6 - 12
src/components/common/Card.js

@@ -3,7 +3,7 @@ import { Text, View } from 'react-native';
 
 const Card = (props) => {
   return (
-    <View style={styles.containerStyle}>
+    <View style={[ styles.containerStyle, props.style ]}>
       { props.children}
     </View>
   );
@@ -12,18 +12,12 @@ const Card = (props) => {
 
 const styles = {
   containerStyle: {
-    borderWidth: 1,
-    borderRadius: 2,
-    borderColor: '#ddd',
-    borderBottomWidth: 0,
-    shadowColor: '#000',
-    shadowOffset: { width: 0, height: 2 },
-    shadowOpacity: 0.1,
-    shadowRadius: 2,
+    borderRadius: 6,
     elevation: 1,
-    marginLeft: 5,
-    marginRight: 5,
-    marginTop: 10
+    marginLeft: 10,
+    marginRight: 10,
+    marginTop: 10,
+	padding: 5
   }
 };
 export { Card};

+ 1 - 4
src/components/common/CardSection.js

@@ -11,12 +11,9 @@ const CardSection = (props) => {
 
 const styles = {
   containerStyle: {
-    borderBottomWidth: 1,
-    padding: 5,
-    backgroundColor: '#fff',
+    padding: 4,
     justifyContent: 'flex-start',
     flexDirection: 'row',
-    borderColor: '#ddd',
     position: 'relative'
   }
 };

+ 6 - 10
src/scenes/Clase.js

@@ -60,17 +60,14 @@ class Clase extends Component {
 			</ScrollableTabView>
 
 			<MyActionButton onPress={() => true}>
-			<ActionButton.Item buttonColor='#22eeee' title='Comentario'>
-				<Icon name='md-create' style={styles.actionButtonIcon} />
-			</ActionButton.Item>
+				<ActionButton.Item buttonColor='#22eeee' title='Comentario'>
+					<Icon name='md-create' style={styles.actionButtonIcon} />
+				</ActionButton.Item>
 
-			<ActionButton.Item onPress={this.onSavePress.bind(this)} buttonColor='#ee22ee' title={title}>
-				<Icon name={icon} style={styles.actionButtonIcon} />
-			</ActionButton.Item>
+				<ActionButton.Item onPress={this.onSavePress.bind(this)} buttonColor='#ee22ee' title={title}>
+					<Icon name={icon} style={styles.actionButtonIcon} />
+				</ActionButton.Item>
 
-			<ActionButton.Item onPress={() => Actions.Menu()} buttonColor='#eeee22' title='Menu'>
-				<Icon name='md-apps' style={styles.actionButtonIcon} />
-			</ActionButton.Item>
 			</MyActionButton>
 
 			</View>
@@ -87,7 +84,6 @@ const styles = {
 	container: {
 		flex: 1,
 		justifyContent: 'center',
-		alignItems: 'center',
 		backgroundColor: '#F5FCFF',
 	}
 };

+ 47 - 28
src/scenes/Cursada/ItemCursada.js

@@ -2,6 +2,7 @@ import React, { Component } from 'react';
 import { Text, ScrollView, View } from 'react-native';
 import { Actions } from 'react-native-router-flux';
 import { Button, Card, CardSection } from '../../components/common';
+import Icon from 'react-native-vector-icons/Ionicons';
 
 
 class ItemCursada extends Component {
@@ -16,35 +17,38 @@ class ItemCursada extends Component {
 		const horaIni = moment(data.horaIni).local().format('HH:mm');
 		const horaFin = moment(data.horaFin).local().format('HH:mm');
 		return (
-			<ScrollView>
-			<Card>
-			<CardSection>
-			<Text style={styles.titleStyle}>
-			{ data.titulo}
-			</Text>
-			</CardSection>
-
-			<CardSection style={{ flexDirection: 'column' }}>
-			<View>
-			<Text>{ data.descCorta}</Text>
-			</View>
-			<View>
-			<Text style={{ fontWeight: '700' }}>Mas info</Text>
-			</View>
-			</CardSection>
-
-			<CardSection>
-			<Text style={{ flex: 1 }}>{ data.dia}</Text>
-			<Text style={{ flex: 2 }}>{ horaIni} a { horaFin}</Text>
-			</CardSection>
-
-			<CardSection>
-			<Button onPress={this.onRowPress.bind(this)}>
-			Ingresar
-			</Button>
-			</CardSection>
+			<Card style={{backgroundColor:'#fff'}}>
+				<CardSection>
+					<Text style={styles.titleStyle}>{data.titulo}</Text>
+				</CardSection>
+
+				<CardSection style={{flexDirection: 'column' }}>
+					<Text style={{fontSize:14,paddingLeft:15,paddingRight:15}}>{data.descCorta}</Text>
+				</CardSection>
+
+				<CardSection>
+					<View style={styles.iconRowView}>
+						<Icon name='ios-calendar-outline' style={styles.icons} />
+						<Text style={styles.iconRowText}>{data.dia}</Text>
+					</View>
+
+					<View style={styles.iconRowView}>
+						<Icon name='md-time' style={styles.icons} />
+						<Text style={styles.iconRowText}>{horaIni} a {horaFin}</Text>
+					</View>
+
+					<View style={styles.iconRowView}>
+						<Icon name='ios-paper-outline' style={styles.icons} />
+						<Text style={styles.iconRowText}>Mas info</Text>
+					</View>
+				</CardSection>
+
+				<CardSection>
+					<Button onPress={this.onRowPress.bind(this)}>
+						Ingresar
+					</Button>
+				</CardSection>
 			</Card>
-			</ScrollView>
 		);
 	}
 }
@@ -53,8 +57,23 @@ const styles = {
 	titleStyle: {
 		fontSize: 18,
 		paddingLeft: 15,
+		paddingRight: 15,
 		textAlign: 'center',
 		flex: 1
+	},
+	icons: {
+		fontSize: 18,
+		marginRight: 10
+	},
+	iconRowText: {
+		fontSize: 12
+	},
+	iconRowView: {
+		flex: 1,
+		flexDirection: 'row',
+		alignItems: 'center',
+		paddingLeft: 10,
+		paddingRight: 10,
 	}
 };
 

+ 9 - 8
src/scenes/ListaClases.js

@@ -82,14 +82,15 @@ class ListaClases extends Component {
 
 		return (
 			<View style={{ flex: 1 }}>
-			<CardSection>
-			<Text style={{ textAlign: 'center', flex: 1, fontSize: 18 }}>{ cursada.titulo}</Text>
-			</CardSection>
-			<ListView
-			enableEmptySections
-			dataSource={this.dataSource}
-			renderRow={this.renderRow.bind(this)}
-			/>
+				<CardSection>
+					<Text style={{ textAlign: 'center', flex: 1, fontSize: 18 }}>{cursada.titulo}</Text>
+				</CardSection>
+				<ListView
+				enableEmptySections
+				dataSource={this.dataSource}
+				renderRow={this.renderRow.bind(this)}
+				style={{backgroundColor:'#eee'}}
+				/>
 			</View>
 		);
 	}

+ 1 - 2
src/scenes/ListaCursadas.js

@@ -32,13 +32,12 @@ class ListaCursadas extends Component {
 		}
 
 		return (
-			<View>
 			<ListView
 			enableEmptySections
 			dataSource={this.dataSource}
 			renderRow={this.renderRow}
+			style={{backgroundColor: '#eee'}}
 			/>
-			</View>
 		);
 	}
 }

+ 5 - 5
src/scenes/MyAbout.js

@@ -34,10 +34,10 @@ class MyAbout extends Component {
 				onPress={() => this.handleClick('geo:-34.60761,-58.437967')}
 			>
 
-			<Icon size={30 } style={[textColor, iconStyle]} name='md-pin' />
-			<Text style={textColor}>
-				Leopoldo Marechal 914, CABA, Argentina.
-			</Text>
+				<Icon size={30} style={[textColor, iconStyle]} name='md-pin' />
+				<Text style={textColor}>
+					Leopoldo Marechal 914, CABA, Argentina.
+				</Text>
 
 			</TouchableOpacity>
 
@@ -45,7 +45,7 @@ class MyAbout extends Component {
 				style={viewStyle}
 				onPress={() => this.handleClick('tel:+541141396860')}
 			>
-				<Icon size={30 } style={[textColor, iconStyle]} name='md-call' />
+				<Icon size={30} style={[textColor, iconStyle]} name='md-call' />
 				<View>
 				<Text style={textColor}>
 				+5411 4139-6860/1