Profesor.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, { Component } from 'react';
  2. import { Text, ScrollView, View, Image } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { profFetch } from '../actions/';
  5. import { Card, CardSection, Button } 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 source={{uri:image}}
  26. 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);