|
|
@@ -1,56 +1,62 @@
|
|
|
-import _ from 'lodash';
|
|
|
import React, { Component } from 'react';
|
|
|
-import { Text, WebView, ScrollView, View, TouchableOpacity } from 'react-native';
|
|
|
+import { View, Text } from 'react-native';
|
|
|
+import { Scene } from 'react-native-router-flux'
|
|
|
import { connect } from 'react-redux';
|
|
|
-import { Actions } from 'react-native-router-flux';
|
|
|
+import Tabs from 'react-native-tabs';
|
|
|
+
|
|
|
import { claseFetch } from '../actions/';
|
|
|
-import { Card, CardSection, Button } from './common';
|
|
|
+import Teoria from './Clase/Teoria';
|
|
|
+import Comentarios from './Clase/Comentarios';
|
|
|
|
|
|
-class Clase extends Component {
|
|
|
+class Clase extends Component {
|
|
|
+ state = { page: 'Teoria' };
|
|
|
|
|
|
- componentWillMount() {
|
|
|
+ componentWillMount() {
|
|
|
this.props.claseFetch(this.props);
|
|
|
}
|
|
|
|
|
|
- render() {
|
|
|
+ renderView() {
|
|
|
+ const { titulo, profesor, texto, comentarios, respuestas } = this.props.clase;
|
|
|
+ if ( this.state.page === 'Teoria' )
|
|
|
+ return <Teoria titulo={titulo} profesor={profesor} texto={texto} />;
|
|
|
+
|
|
|
+ if ( this.state.page === 'Comentarios' )
|
|
|
+ return <Comentarios comentarios={comentarios} respuestas={respuestas} />;
|
|
|
+
|
|
|
+ return <Text>{this.state.page}!!!</Text>;
|
|
|
+ }
|
|
|
+ render() {
|
|
|
const { clase } = this.props;
|
|
|
- console.log("props", this.props);
|
|
|
- return (
|
|
|
- <ScrollView>
|
|
|
- <Card>
|
|
|
- <CardSection>
|
|
|
- <Text>{clase.titulo}</Text>
|
|
|
- </CardSection>
|
|
|
-
|
|
|
- <CardSection>
|
|
|
- <TouchableOpacity onPress={() => Actions.ViewProf({ id: clase.profesor._id})}>
|
|
|
- <Text style={{flex:1, color: '#007aff', fontWeight: '600'}}>
|
|
|
- {clase.profesor.nombre} {clase.profesor.apellido}
|
|
|
- </Text>
|
|
|
- </TouchableOpacity>
|
|
|
- </CardSection>
|
|
|
-
|
|
|
- <CardSection>
|
|
|
- <WebView
|
|
|
- style={{height:1700}}
|
|
|
- scalesPageToFit={true}
|
|
|
- javaScriptEnabled={false}
|
|
|
- source={{html: clase.texto}} />
|
|
|
- </CardSection>
|
|
|
- <CardSection>
|
|
|
- <Text>
|
|
|
- Comentarios
|
|
|
- </Text>
|
|
|
- </CardSection>
|
|
|
- </Card>
|
|
|
- </ScrollView>
|
|
|
- );
|
|
|
- }
|
|
|
+ console.log(clase);
|
|
|
+
|
|
|
+ return (
|
|
|
+ <View style={styles.container}>
|
|
|
+ <Tabs selected={this.state.page} style={{backgroundColor:'white'}}
|
|
|
+ selectedStyle={{fontWeight:"700"}}
|
|
|
+ onSelect={ el => {
|
|
|
+ this.setState({ page: el.props.name })
|
|
|
+ } }>
|
|
|
+ <Text name="Teoria">Teoria</Text>
|
|
|
+ <Text name="Videos">Videos</Text>
|
|
|
+ <Text name="Comentarios">Comentarios</Text>
|
|
|
+ </Tabs>
|
|
|
+ {this.renderView()}
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const styles = {
|
|
|
+ container: {
|
|
|
+ flex: 1,
|
|
|
+ justifyContent: 'center',
|
|
|
+ alignItems: 'center',
|
|
|
+ backgroundColor: '#F5FCFF',
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
const { curClase } = state.cursadasR;
|
|
|
- console.log("State:", state);
|
|
|
return { clase: curClase };
|
|
|
};
|
|
|
|