refactor(mobile): Update TimelineViewSelector context menu handling

- Modify TimelineViewSelector to pass view-specific context menu props
- Adjust TimelineViewSelectorContextMenu to handle undefined viewId more precisely
- Simplify context menu rendering logic for view-based timelines

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-02-19 21:44:29 +08:00
parent 0d219a5a28
commit 63e6a30d83
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 2 additions and 5 deletions

View File

@ -108,10 +108,7 @@ function ViewItem({ view }: { view: ViewDefinition }) {
}, [isActive, unreadCount])
return (
<TimelineViewSelectorContextMenu
viewId={selectedFeed && "viewId" in selectedFeed ? selectedFeed.viewId : undefined}
type={selectedFeed?.type}
>
<TimelineViewSelectorContextMenu type="view" viewId={view.view}>
<ItemWrapper
isActive={isActive}
onPress={() => selectTimeline({ type: "view", viewId: view.view })}

View File

@ -7,7 +7,7 @@ import { unreadSyncService } from "@/src/store/unread/store"
export const TimelineViewSelectorContextMenu: FC<
PropsWithChildren<{ type: string | undefined; viewId: FeedViewType | undefined }>
> = ({ children, type, viewId }) => {
if (type !== "view" || !viewId) return children
if (type !== "view" || viewId === undefined) return children
return (
<ContextMenu.Root>