diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js
index 78c43ed0e..2d07ddeb3 100644
--- a/native/avatars/edit-thread-avatar.react.js
+++ b/native/avatars/edit-thread-avatar.react.js
@@ -1,40 +1,43 @@
// @flow
import * as React from 'react';
import { TouchableOpacity } from 'react-native';
+import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js';
+
import {
useSelectAndUploadFromGallery,
useShowAvatarActionSheet,
} from './avatar-hooks.js';
import EditAvatarBadge from './edit-avatar-badge.react.js';
+import ThreadAvatar from './thread-avatar.react.js';
type Props = {
- +children: React.Node,
+ +threadInfo: RawThreadInfo | ThreadInfo,
+onPressEmojiAvatarFlow: () => mixed,
+disabled?: boolean,
};
function EditThreadAvatar(props: Props): React.Node {
- const { onPressEmojiAvatarFlow, children, disabled } = props;
+ const { threadInfo, onPressEmojiAvatarFlow, disabled } = props;
const selectAndUploadFromGallery = useSelectAndUploadFromGallery();
const actionSheetConfig = React.useMemo(
() => [
{ id: 'emoji', onPress: onPressEmojiAvatarFlow },
{ id: 'image', onPress: selectAndUploadFromGallery },
],
[onPressEmojiAvatarFlow, selectAndUploadFromGallery],
);
const showAvatarActionSheet = useShowAvatarActionSheet(actionSheetConfig);
return (
- {children}
+
{!disabled ? : null}
);
}
export default EditThreadAvatar;
diff --git a/native/chat/settings/thread-settings-avatar.react.js b/native/chat/settings/thread-settings-avatar.react.js
index 9ecf1cf30..4a3a60923 100644
--- a/native/chat/settings/thread-settings-avatar.react.js
+++ b/native/chat/settings/thread-settings-avatar.react.js
@@ -1,59 +1,57 @@
// @flow
import { useNavigation } from '@react-navigation/native';
import * as React from 'react';
import { View } from 'react-native';
import { type ResolvedThreadInfo } from 'lib/types/thread-types.js';
import EditThreadAvatar from '../../avatars/edit-thread-avatar.react.js';
-import ThreadAvatar from '../../avatars/thread-avatar.react.js';
import { EmojiAvatarCreationRouteName } from '../../navigation/route-names.js';
import { useStyles } from '../../themes/colors.js';
type Props = {
+threadInfo: ResolvedThreadInfo,
+canChangeSettings: boolean,
};
function ThreadSettingsAvatar(props: Props): React.Node {
const { threadInfo, canChangeSettings } = props;
const { navigate } = useNavigation();
const styles = useStyles(unboundStyles);
const onPressEmojiAvatarFlow = React.useCallback(() => {
navigate<'EmojiAvatarCreation'>({
name: EmojiAvatarCreationRouteName,
params: {
threadID: threadInfo.id,
containingThreadID: threadInfo.containingThreadID,
},
});
}, [navigate, threadInfo.containingThreadID, threadInfo.id]);
return (
-
-
+ threadInfo={threadInfo}
+ />
);
}
const unboundStyles = {
container: {
alignItems: 'center',
backgroundColor: 'panelForeground',
flex: 1,
paddingVertical: 16,
},
};
const MemoizedThreadSettingsAvatar: React.ComponentType =
React.memo(ThreadSettingsAvatar);
export default MemoizedThreadSettingsAvatar;