Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32846084
D7136.1768096484.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7136.1768096484.diff
View Options
diff --git a/native/navigation/community-drawer-item.react.js b/native/navigation/community-drawer-item.react.js
--- a/native/navigation/community-drawer-item.react.js
+++ b/native/navigation/community-drawer-item.react.js
@@ -3,15 +3,18 @@
import * as React from 'react';
import { View, FlatList, TouchableOpacity } from 'react-native';
+import { useGetAvatarForThread } from 'lib/shared/avatar-utils.js';
import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react.js';
import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js';
import { ExpandButton, ExpandButtonDisabled } from './expand-buttons.react.js';
import SubchannelsButton from './subchannels-button.react.js';
import type { MessageListParams } from '../chat/message-list-types.js';
+import Avatar from '../components/avatar.react.js';
import { SingleLine } from '../components/single-line.react.js';
import { useStyles } from '../themes/colors.js';
import type { TextStyle } from '../types/styles.js';
+import { useShouldRenderAvatars } from '../utils/avatar-utils.js';
export type DrawerItemProps = {
+itemData: CommunityDrawerItemData<TextStyle>,
@@ -78,6 +81,22 @@
}, [navigateToThread, threadInfo]);
const { uiName } = useResolvedThreadInfo(threadInfo);
+
+ const avatarInfo = useGetAvatarForThread(threadInfo);
+ const shouldRenderAvatars = useShouldRenderAvatars();
+
+ const avatar = React.useMemo(() => {
+ if (!shouldRenderAvatars) {
+ return null;
+ }
+
+ return (
+ <View style={styles.avatarContainer}>
+ <Avatar size="micro" avatarInfo={avatarInfo} />
+ </View>
+ );
+ }, [avatarInfo, shouldRenderAvatars, styles.avatarContainer]);
+
return (
<View>
<View style={styles.threadEntry}>
@@ -87,6 +106,7 @@
style={styles.textTouchableWrapper}
onLongPress={onExpandToggled}
>
+ {avatar}
<SingleLine style={labelStyle}>{uiName}</SingleLine>
</TouchableOpacity>
</View>
@@ -96,6 +116,9 @@
}
const unboundStyles = {
+ avatarContainer: {
+ marginRight: 8,
+ },
chatView: {
marginLeft: 16,
},
@@ -105,6 +128,8 @@
},
textTouchableWrapper: {
flex: 1,
+ flexDirection: 'row',
+ alignItems: 'center',
},
subchannelsButton: {
marginLeft: 24,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 11, 1:54 AM (4 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5917491
Default Alt Text
D7136.1768096484.diff (2 KB)
Attached To
Mode
D7136: [native] render thread avatars in community drawer
Attached
Detach File
Event Timeline
Log In to Comment