diff --git a/app/components/post_profile_picture/post_profile_picture.js b/app/components/post_profile_picture/post_profile_picture.js
index 2b3162250..e2fb4bfa5 100644
--- a/app/components/post_profile_picture/post_profile_picture.js
+++ b/app/components/post_profile_picture/post_profile_picture.js
@@ -1,7 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import React from 'react';
+import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Image, TouchableOpacity, View} from 'react-native';
@@ -12,29 +12,47 @@ import webhookIcon from 'assets/images/icons/webhook.jpg';
const PROFILE_PICTURE_SIZE = 32;
-function PostProfilePicture(props) {
- const {
- enablePostIconOverride,
- fromWebHook,
- isSystemMessage,
- onViewUserProfile,
- overrideIconUrl,
- theme,
- userId
- } = props;
- if (isSystemMessage) {
- return (
-
-
-
- );
- } else if (fromWebHook) {
- if (enablePostIconOverride) {
+export default class PostProfilePicture extends PureComponent {
+ static propTypes = {
+ enablePostIconOverride: PropTypes.bool,
+ fromWebHook: PropTypes.bool,
+ isSystemMessage: PropTypes.bool,
+ overrideIconUrl: PropTypes.string,
+ onViewUserProfile: PropTypes.func,
+ theme: PropTypes.object,
+ userId: PropTypes.string
+ };
+
+ static defaultProps = {
+ onViewUserProfile: emptyFunction
+ };
+
+ render() {
+ const {
+ enablePostIconOverride,
+ fromWebHook,
+ isSystemMessage,
+ onViewUserProfile,
+ overrideIconUrl,
+ theme,
+ userId
+ } = this.props;
+
+ if (isSystemMessage) {
+ return (
+
+
+
+ );
+ }
+
+ if (fromWebHook && enablePostIconOverride) {
const icon = overrideIconUrl ? {uri: overrideIconUrl} : webhookIcon;
+
return (
);
+
+ if (!fromWebHook) {
+ component = (
+
+ {component}
+
+ );
+ }
+
+ return component;
}
-
- return (
-
-
-
- );
}
-
-PostProfilePicture.propTypes = {
- enablePostIconOverride: PropTypes.bool,
- fromWebHook: PropTypes.bool,
- isSystemMessage: PropTypes.bool,
- overrideIconUrl: PropTypes.string,
- onViewUserProfile: PropTypes.func,
- theme: PropTypes.object,
- userId: PropTypes.string
-};
-
-PostProfilePicture.defaultProps = {
- onViewUserProfile: emptyFunction
-};
-
-export default PostProfilePicture;