Profesor.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Component } from 'react';
  2. import { Text, ScrollView, Image } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { profFetch } from '../actions/';
  5. import { Card, CardSection } from '../components/common';
  6. class Clase extends Component {
  7. componentWillMount() {
  8. console.log('profProps', this.props);
  9. this.props.profFetch({ id: this.props.id });
  10. }
  11. render() {
  12. console.log('ProfRender', this.props);
  13. const { profesor } = this.props;
  14. const image = `https://plataforma.especificosba.com.ar${ profesor.imagen}`;
  15. console.log(image);
  16. return (
  17. <ScrollView>
  18. <Card>
  19. <CardSection>
  20. <Text style={{ textAlign: 'center', fontSize: 18, flex: 1, fontWeight: '700' }}>
  21. { profesor.nombre} { profesor.apellido}
  22. </Text>
  23. </CardSection>
  24. <CardSection>
  25. <Image
  26. source={{ uri: image }} resizeMode='contain'
  27. style={{ height: 250, flex: 1 }}
  28. />
  29. </CardSection>
  30. <CardSection>
  31. <Text>E-mail: { profesor.email}</Text>
  32. </CardSection>
  33. <CardSection>
  34. <Text>Web: { profesor.web}</Text>
  35. </CardSection>
  36. <CardSection>
  37. <Text>{ profesor.intro}</Text>
  38. </CardSection>
  39. </Card>
  40. </ScrollView>
  41. );
  42. }
  43. }
  44. const mapStateToProps = state => {
  45. console.log('ProfState: ', state);
  46. return { profesor: state.ProfReducer.profesor };
  47. };
  48. export default connect(mapStateToProps, { profFetch })(Clase);