* Reduced re-renders of Channel screen * Switched some components to be PureComponents * Stopped waiting for drawer to close to switch channels * Fixed post list being stuck loading * Fixed incorrectly removed ref * Removed loader from channel post list * Removed unused prop * Re-added ChannelDrawer.swiperIndex * Changed ChannelPostTextbox to only require a single draft * Re-enable InteractionManager on ChannelDrawer * Fixed ChannelDrawer.joinChannel and removed duplicated code * Moved getting device dimensions into render method * Switched ChannelsList to be a PureComponent
38 lines
940 B
JavaScript
38 lines
940 B
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import {injectIntl, intlShape} from 'react-intl';
|
|
import {Text} from 'react-native';
|
|
|
|
class FormattedTime extends React.PureComponent {
|
|
static propTypes = {
|
|
intl: intlShape.isRequired,
|
|
value: PropTypes.any.isRequired,
|
|
format: PropTypes.string,
|
|
children: 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);
|
|
|