/** * Created by greg on 2016-06-27. */ import React, { Component } from 'react'; import { Navigator, TouchableOpacity, Text, View } from 'react-native'; import styles from '../../styles/styles'; import BodyStore from '../../stores/body'; class Weight 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(), }; } render() { return ( }/> ); } renderScene(route, navigator) { return ( {this.state.weightFormatted} ); } } var NavigationBarRouteMapper = { LeftButton(route, navigator, index, nextState) { return ( {navigator.parentNavigator.pop()}}> Back ); }, RightButton(route, navigator, index, nextState) { return null; }, Title(route, navigator, index, nextState) { return ( Weight ); } }; module.exports = Weight; export default Weight;