diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/AvatarContainer.tsx
similarity index 61%
rename from app/containers/Avatar/index.tsx
rename to app/containers/Avatar/AvatarContainer.tsx
index ae3537865..9be1a394a 100644
--- a/app/containers/Avatar/index.tsx
+++ b/app/containers/Avatar/AvatarContainer.tsx
@@ -1,14 +1,10 @@
import React from 'react';
import { shallowEqual, useSelector } from 'react-redux';
-import Button from '../Button';
import { IApplicationState } from '../../definitions';
import { getUserSelector } from '../../selectors/login';
import Avatar from './Avatar';
import { IAvatar } from './interfaces';
-import I18n from '../../i18n';
-import { useTheme } from '../../theme';
-import styles from './styles';
import { useAvatarETag } from './useAvatarETag';
interface IAvatarContainer extends IAvatar {
@@ -27,11 +23,8 @@ const AvatarContainer = ({
onPress,
getCustomEmoji,
isStatic,
- rid,
- handleEdit
+ rid
}: IAvatarContainer): React.ReactElement => {
- const { colors } = useTheme();
-
const server = useSelector((state: IApplicationState) => state.share.server.server || state.server.server);
const serverVersion = useSelector((state: IApplicationState) => state.share.server.version || state.server.version);
const { id, token, username } = useSelector(
@@ -56,40 +49,27 @@ const AvatarContainer = ({
const { avatarETag } = useAvatarETag({ username, text, type, rid });
return (
- <>
-
- {handleEdit ? (
-
- ) : null}
- >
+
);
};
diff --git a/app/containers/Avatar/AvatarWithEdit.tsx b/app/containers/Avatar/AvatarWithEdit.tsx
new file mode 100644
index 000000000..236d3cfc5
--- /dev/null
+++ b/app/containers/Avatar/AvatarWithEdit.tsx
@@ -0,0 +1,62 @@
+import React from 'react';
+
+import Button from '../Button';
+import AvatarContainer from './AvatarContainer';
+import { IAvatar } from './interfaces';
+import I18n from '../../i18n';
+import { useTheme } from '../../theme';
+import styles from './styles';
+
+interface IAvatarContainer extends IAvatar {
+ handleEdit?: () => void;
+}
+
+const AvatarWithEdit = ({
+ style,
+ text = '',
+ avatar,
+ emoji,
+ size,
+ borderRadius,
+ type,
+ children,
+ onPress,
+ getCustomEmoji,
+ isStatic,
+ rid,
+ handleEdit
+}: IAvatarContainer): React.ReactElement => {
+ const { colors } = useTheme();
+
+ return (
+ <>
+
+ {handleEdit ? (
+
+ ) : null}
+ >
+ );
+};
+
+export default AvatarWithEdit;
diff --git a/app/containers/Avatar/index.ts b/app/containers/Avatar/index.ts
new file mode 100644
index 000000000..79e76c146
--- /dev/null
+++ b/app/containers/Avatar/index.ts
@@ -0,0 +1,5 @@
+import Avatar from './AvatarContainer';
+
+export { default as AvatarWithEdit } from './AvatarWithEdit';
+
+export default Avatar;
diff --git a/app/views/ProfileView/index.tsx b/app/views/ProfileView/index.tsx
index dca6b0dc3..9a8c1891a 100644
--- a/app/views/ProfileView/index.tsx
+++ b/app/views/ProfileView/index.tsx
@@ -18,7 +18,7 @@ import { FormTextInput } from '../../containers/TextInput';
import { events, logEvent } from '../../lib/methods/helpers/log';
import I18n from '../../i18n';
import Button from '../../containers/Button';
-import Avatar from '../../containers/Avatar';
+import { AvatarWithEdit } from '../../containers/Avatar';
import { setUser } from '../../actions/login';
import * as HeaderButton from '../../containers/HeaderButton';
import StatusBar from '../../containers/StatusBar';
@@ -411,7 +411,7 @@ class ProfileView extends React.Component
-
-
+
{
diff --git a/app/views/RoomInfoView/index.tsx b/app/views/RoomInfoView/index.tsx
index 9a5ce9a0a..afee54bad 100644
--- a/app/views/RoomInfoView/index.tsx
+++ b/app/views/RoomInfoView/index.tsx
@@ -10,7 +10,7 @@ import { Observable, Subscription } from 'rxjs';
import { CustomIcon, TIconsName } from '../../containers/CustomIcon';
import Status from '../../containers/Status';
-import Avatar from '../../containers/Avatar';
+import { AvatarWithEdit } from '../../containers/Avatar';
import sharedStyles from '../Styles';
import RoomTypeIcon from '../../containers/RoomTypeIcon';
import I18n from '../../i18n';
@@ -183,17 +183,17 @@ class RoomInfoView extends React.Component (
-
- {
- const isLivechat = t === SubscriptionType.OMNICHANNEL;
- logEvent(events[`RI_GO_${isLivechat ? 'LIVECHAT' : 'RI'}_EDIT`]);
- navigation.navigate(isLivechat ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser });
- }}
- testID='room-info-view-edit-button'
- />
-
+
+ {
+ const isLivechat = t === SubscriptionType.OMNICHANNEL;
+ logEvent(events[`RI_GO_${isLivechat ? 'LIVECHAT' : 'RI'}_EDIT`]);
+ navigation.navigate(isLivechat ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser });
+ }}
+ testID='room-info-view-edit-button'
+ />
+
)
: undefined
});
@@ -404,7 +404,7 @@ class RoomInfoView extends React.Component {
const { theme } = this.props;
@@ -412,7 +412,7 @@ class RoomInfoView extends React.Component
) : null}
-
+
);
};