mattermost-mobile/app/components/formatted_time.js
Harrison Healey 4ecd3758e7 Render posts for the current channel (#153)
* Added selectChannel action

* Fixed selected team not being cleared on logout

* Fixed posts and postsByChannel not being initialized correctly

* Added basic post rendering

* Renamed selectors files to be plural

* Removed empty file

* Fixed unit tests after merge

* Removing unnecessary code
2016-12-23 10:55:33 -03:00

37 lines
910 B
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import {injectIntl, intlShape} from 'react-intl';
import {Text} from 'react-native';
class FormattedTime extends React.Component {
static propTypes = {
intl: intlShape.isRequired,
value: React.PropTypes.any.isRequired,
format: React.PropTypes.string,
children: React.PropTypes.func
};
render() {
const {
intl,
value,
children,
...props
} = this.props;
Reflect.deleteProperty(props, 'format');
const formattedTime = intl.formatTime(value, this.props);
if (typeof children === 'function') {
return children(formattedTime);
}
return <Text>{formattedTime}</Text>;
}
}
export default injectIntl(FormattedTime);