/**
* Created by greg on 2016-06-27.
*/
import React, { Component } from 'react';
import {
Navigator,
TouchableOpacity,
ScrollView,
Text,
View
} from 'react-native';
import TimerMixin from 'react-timer-mixin';
var reactMixin = require('react-mixin');
import styles from '../../styles/styles';
import BodyStore from '../../stores/body';
import DashboardItem from './item';
class Dashboard extends Component {
constructor(props) {
super(props);
this.state = this._getStateObject();
}
componentDidMount() {
this.unsub = BodyStore.listen(this._onBodyStoreEvent.bind(this));
}
componentWillUnmount() {
this.unsub();
}
_onBodyStoreEvent(evt) {
this.setState(this._getStateObject())
}
_getStateObject() {
return {
weightFormatted: BodyStore.GetWeightFormatted(),
heightFormatted: BodyStore.GetHeightFormatted(),
bmiFormatted: BodyStore.GetBMIFormatted(),
bodyFatFormatted: BodyStore.GetBodyFatPercentageFormatted(),
leanBodyMassFormatted: BodyStore.GetLeanBodyMassFormatted(),
};
}
_onPressItem(key) {
console.log('_onPressItem() ==> ', key);
let self = this;
this.requestAnimationFrame(() => {
this.props.navigator.push({
name: key
});
})
}
render() {
return (
}/>
);
}
renderScene(route, navigator) {
return (
);
}
}
reactMixin(Dashboard.prototype, TimerMixin);
var NavigationBarRouteMapper = {
LeftButton(route, navigator, index, nextState) {
return null;
},
RightButton(route, navigator, index, nextState) {
return null;
},
Title(route, navigator, index, nextState) {
return (
HealthKit Body Measurements
);
}
};
module.exports = Dashboard;
export default Dashboard;