Undo changes, add timeFormat prop

This commit is contained in:
Gerzon Z 2021-10-05 12:00:00 -04:00
parent 89a2381a1e
commit a226cad57c
2 changed files with 14 additions and 7 deletions

View File

@ -36,16 +36,20 @@ const Attachments = React.memo(
return attachments.map((file: any, index: number) => {
if (file.image_url) {
return <Image key={index} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
return (
<Image key={file.image_url} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />
);
}
if (file.audio_url) {
return <Audio key={index} file={file} getCustomEmoji={getCustomEmoji} theme={theme} />;
return <Audio key={file.audio_url} file={file} getCustomEmoji={getCustomEmoji} theme={theme} />;
}
if (file.video_url) {
return <Video key={index} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
return (
<Video key={file.video_url} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />
);
}
if (file.actions && file.actions.length > 0) {
return <AttachedActions key={index} attachment={file} theme={theme} />;
return <AttachedActions key={file} attachment={file} theme={theme} />;
}
return (

View File

@ -47,7 +47,8 @@ class ThreadMessagesView extends React.Component {
useRealName: PropTypes.bool,
theme: PropTypes.string,
isMasterDetail: PropTypes.bool,
insets: PropTypes.object
insets: PropTypes.object,
Message_TimeFormat: PropTypes.string
};
constructor(props) {
@ -412,7 +413,7 @@ class ThreadMessagesView extends React.Component {
};
renderItem = ({ item }) => {
const { user, navigation, baseUrl, useRealName } = this.props;
const { user, navigation, baseUrl, useRealName, Message_TimeFormat } = this.props;
const badgeColor = this.getBadgeColor(item);
return (
<Item
@ -425,6 +426,7 @@ class ThreadMessagesView extends React.Component {
badgeColor
}}
thread
timeFormat={Message_TimeFormat}
onPress={this.onThreadPress}
toggleFollowThread={this.toggleFollowThread}
/>
@ -506,7 +508,8 @@ const mapStateToProps = state => ({
baseUrl: state.server.server,
user: getUserSelector(state),
useRealName: state.settings.UI_Use_Real_Name,
isMasterDetail: state.app.isMasterDetail
isMasterDetail: state.app.isMasterDetail,
Message_TimeFormat: state.settings.Message_TimeFormat
});
export default connect(mapStateToProps)(withTheme(withSafeAreaInsets(ThreadMessagesView)));