diff --git a/shared/components/detailView.js b/shared/components/detailView.js index cc4e0e6..2483803 100644 --- a/shared/components/detailView.js +++ b/shared/components/detailView.js @@ -8,6 +8,7 @@ import IMG_BUTTON_RIGHT from '../resources/arrow_right/drawable-xxxhdpi/arrow.pn import IMG_BUTTON_FLAG from '../resources/btn_flag/drawable-xxxhdpi/btn_flag.png'; import {Actions} from 'react-native-router-flux'; import TimerMixin from 'react-timer-mixin'; +import { getAccessToken, getUserInformation } from '../actions/authActions'; const styles = { wrapper: { @@ -59,13 +60,9 @@ const styles = { ...Platform.select({ android: { fontFamily: 'Roboto-Regular' - }, - ios: { - fontWeight: 'bold' } }), - fontSize: 14, - fontWeight: 'normal' + fontSize: 14 } }; @@ -80,7 +77,11 @@ export default class DetailView extends Component { messageVisible: false, currentReport: '', data: [], - currentIndex: 0 + currentIndex: 0, + name: 'name', + profileImgUrl: '', + profileImageHeight: 0, + profileImageWidth: 0 }; this.renderDate = this.renderDate.bind(this); this.handleClick = this.handleClick.bind(this); @@ -95,6 +96,18 @@ export default class DetailView extends Component { this.firstTry = true; } + componentDidMount() { + getAccessToken().then((accessToken) => { + return getUserInformation(this.props.dataSource.userKey, accessToken); + }) + .then((rjson) => { + this.setState({ + name: rjson.name, + profileImgUrl: rjson.profileImgUrl + }); + }); + } + toggleModalVisible() { this.setState({modalVisible: !this.state.modalVisible}); } @@ -278,11 +291,22 @@ export default class DetailView extends Component { - + this.setState({ + profileImageHeight: evt.nativeEvent.layout.height, + profileImageWidth: evt.nativeEvent.layout.width + })} + > + + - Name + {this.state.name} @@ -304,11 +328,21 @@ export default class DetailView extends Component { (this.state.isClicked) ? : - + this.setState({ + profileImageWidth: evt.nativeEvent.layout.width + })} + > + + - Name + {this.state.name}