Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3378254
D6002.id20033.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6002.id20033.diff
View Options
diff --git a/native/navigation/community-drawer-content.react.js b/native/navigation/community-drawer-content.react.js
--- a/native/navigation/community-drawer-content.react.js
+++ b/native/navigation/community-drawer-content.react.js
@@ -43,6 +43,7 @@
threadInfo: item.threadInfo,
itemChildren: item.itemChildren,
labelStyle: item.labelStyle,
+ showSubchannelsButton: item.subchannelsButton,
};
return (
<CommunityDrawerItemCommunity
@@ -94,6 +95,7 @@
threadInfo: community,
itemChildren: [],
labelStyle: labelStyles[0],
+ subchannelsButton: false,
}));
let queue = result.map(item => [item, 0]);
@@ -108,6 +110,9 @@
threadInfo: childItem,
itemChildren: [],
labelStyle: labelStyles[Math.min(lvl + 1, labelStyles.length - 1)],
+ showSubchannelsButton:
+ lvl + 1 === MAX_DEPTH &&
+ childThreadInfosMap[childItem.id]?.length > 0,
}));
queue = queue.concat(
item.itemChildren.map(childItem => [childItem, lvl + 1]),
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
@@ -10,11 +10,13 @@
import { useStyles } from '../themes/colors';
import type { TextStyle } from '../types/styles';
import { ExpandButton, ExpandButtonDisabled } from './expand-buttons.react';
+import SubchannelsButton from './subchannels-button.react';
export type CommunityDrawerItemData = {
+threadInfo: ThreadInfo,
+itemChildren?: $ReadOnlyArray<CommunityDrawerItemData>,
+labelStyle: TextStyle,
+ +showSubchannelsButton: boolean,
};
export type DrawerItemProps = {
@@ -26,7 +28,7 @@
function CommunityDrawerItem(props: DrawerItemProps): React.Node {
const {
- itemData: { threadInfo, itemChildren, labelStyle },
+ itemData: { threadInfo, itemChildren, labelStyle, showSubchannelsButton },
navigateToThread,
expanded,
toggleExpanded,
@@ -49,19 +51,33 @@
if (!expanded) {
return null;
}
+ if (showSubchannelsButton) {
+ return (
+ <View style={styles.subchannelsButton}>
+ <SubchannelsButton threadInfo={threadInfo} />
+ </View>
+ );
+ }
return <FlatList data={itemChildren} renderItem={renderItem} />;
- }, [expanded, itemChildren, renderItem]);
+ }, [
+ expanded,
+ itemChildren,
+ renderItem,
+ showSubchannelsButton,
+ styles.subchannelsButton,
+ threadInfo,
+ ]);
const onExpandToggled = React.useCallback(() => {
toggleExpanded(threadInfo.id);
}, [toggleExpanded, threadInfo.id]);
const itemExpandButton = React.useMemo(() => {
- if (!itemChildren?.length) {
+ if (!itemChildren?.length && !showSubchannelsButton) {
return <ExpandButtonDisabled />;
}
return <ExpandButton onPress={onExpandToggled} expanded={expanded} />;
- }, [itemChildren?.length, expanded, onExpandToggled]);
+ }, [itemChildren?.length, showSubchannelsButton, onExpandToggled, expanded]);
const onPress = React.useCallback(() => {
navigateToThread({ threadInfo });
@@ -95,6 +111,10 @@
textTouchableWrapper: {
flex: 1,
},
+ subchannelsButton: {
+ marginLeft: 24,
+ marginBottom: 6,
+ },
};
export type CommunityDrawerItemChatProps = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 9:39 AM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593618
Default Alt Text
D6002.id20033.diff (3 KB)
Attached To
Mode
D6002: [native] Add subchannels button to drawer items
Attached
Detach File
Event Timeline
Log In to Comment