feat(rn-component): refactor context menu for ios
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
"react-native": "0.76.5",
|
||||
"react-native-context-menu-view": "1.16.0",
|
||||
"react-native-gesture-handler": "~2.20.2",
|
||||
"react-native-ios-context-menu": "3.1.0",
|
||||
"react-native-ios-utilities": "5.1.0",
|
||||
"react-native-keyboard-controller": "^1.15.0",
|
||||
"react-native-pager-view": "6.6.1",
|
||||
"react-native-reanimated": "~3.16.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { FC } from "react"
|
||||
|
||||
import type { ContextMenuProps } from "./index.ios"
|
||||
import type { ContextMenuProps } from "./types"
|
||||
|
||||
export const ContextMenu: FC<ContextMenuProps> = () => {
|
||||
throw new Error("ContextMenu not implemented on Android")
|
||||
|
||||
@@ -1 +1,91 @@
|
||||
export { default as ContextMenu, type ContextMenuProps } from "react-native-context-menu-view"
|
||||
// export { default as ContextMenu, type ContextMenuProps } from "react-native-context-menu-view"
|
||||
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { useMemo, useState } from "react"
|
||||
import { View } from "react-native"
|
||||
import type { MenuAttributes, MenuConfig, MenuElementConfig } from "react-native-ios-context-menu"
|
||||
import { ContextMenuView } from "react-native-ios-context-menu"
|
||||
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
import type { ContextMenuProps, IContextMenuItemConfig } from "./types"
|
||||
|
||||
export const ContextMenu: FC<ContextMenuProps & PropsWithChildren> = ({
|
||||
config,
|
||||
onPressMenuItem,
|
||||
children,
|
||||
renderPreview,
|
||||
...props
|
||||
}) => {
|
||||
const [actionKeyMap] = useState(() => new Map<string, IContextMenuItemConfig>())
|
||||
const menuViewConfig = useMemo((): MenuConfig => {
|
||||
const createMenuItems = (items: typeof config.items): MenuElementConfig[] => {
|
||||
return items
|
||||
.filter((item) => !!item)
|
||||
.map((item) => {
|
||||
actionKeyMap.set(item.actionKey, item)
|
||||
|
||||
const menuAttributes: MenuAttributes[] = []
|
||||
if (item.destructive) {
|
||||
menuAttributes.push("destructive")
|
||||
}
|
||||
if (item.disabled) {
|
||||
menuAttributes.push("disabled")
|
||||
}
|
||||
if (item.hidden) {
|
||||
menuAttributes.push("hidden")
|
||||
}
|
||||
|
||||
const menuItem: MenuElementConfig = {
|
||||
actionTitle: item.title,
|
||||
actionKey: item.actionKey,
|
||||
icon: item.systemIcon ? { iconType: "SYSTEM", iconValue: item.systemIcon } : undefined,
|
||||
menuAttributes,
|
||||
}
|
||||
|
||||
if (item.subMenu) {
|
||||
const subMenuConfig = menuItem as any as MenuConfig
|
||||
subMenuConfig.menuTitle = item.subMenu.title || item.title || ""
|
||||
subMenuConfig.menuSubtitle = item.subMenu.subTitle || ""
|
||||
subMenuConfig.menuItems = createMenuItems(item.subMenu.items)
|
||||
}
|
||||
|
||||
if (item.checked) {
|
||||
menuItem.menuState = "on"
|
||||
}
|
||||
|
||||
return menuItem
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
menuTitle: config.title || "",
|
||||
menuSubtitle: config.subTitle || "",
|
||||
menuItems: createMenuItems(config.items),
|
||||
}
|
||||
}, [config, actionKeyMap])
|
||||
|
||||
const backgroundColor = useColor("systemBackground")
|
||||
return (
|
||||
<View {...props}>
|
||||
<ContextMenuView
|
||||
previewConfig={
|
||||
renderPreview
|
||||
? {
|
||||
backgroundColor,
|
||||
previewType: "CUSTOM",
|
||||
previewSize: "STRETCH",
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
renderPreview={renderPreview}
|
||||
menuConfig={menuViewConfig}
|
||||
onPressMenuItem={(e) => {
|
||||
onPressMenuItem(actionKeyMap.get(e.nativeEvent.actionKey)!)
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ContextMenuView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from "./index.ios"
|
||||
@@ -0,0 +1 @@
|
||||
export { ContextMenu } from "./index.ios"
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { ViewProps } from "react-native"
|
||||
import type { RenderItem } from "react-native-ios-context-menu"
|
||||
|
||||
export interface IContextMenuConfig {
|
||||
title?: string
|
||||
subTitle?: string
|
||||
items: NullableContextMenuItemConfig[]
|
||||
}
|
||||
|
||||
export type NullableContextMenuItemConfig = IContextMenuItemConfig | false | null | undefined
|
||||
export interface IContextMenuItemConfig {
|
||||
title: string
|
||||
// icon?: IconConfig | ImageItemConfig
|
||||
/**
|
||||
* @note only available on iOS
|
||||
*/
|
||||
systemIcon?: string
|
||||
|
||||
subMenu?: IContextMenuConfig
|
||||
|
||||
destructive?: boolean
|
||||
disabled?: boolean
|
||||
hidden?: boolean
|
||||
checked?: boolean
|
||||
|
||||
actionKey: string
|
||||
}
|
||||
|
||||
export interface ContextMenuProps extends ViewProps {
|
||||
config: IContextMenuConfig
|
||||
onPressMenuItem: (item: IContextMenuItemConfig) => void
|
||||
|
||||
/**
|
||||
* @note only available on iOS
|
||||
*/
|
||||
renderPreview?: RenderItem
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { useCallback, useMemo } from "react"
|
||||
import type { NativeSyntheticEvent } from "react-native"
|
||||
import { useMemo } from "react"
|
||||
import { Alert, Clipboard } from "react-native"
|
||||
import type {
|
||||
ContextMenuAction,
|
||||
ContextMenuOnPressNativeEvent,
|
||||
} from "react-native-context-menu-view"
|
||||
import { useEventCallback } from "usehooks-ts"
|
||||
|
||||
import { ContextMenu } from "@/src/components/ui/context-menu"
|
||||
import type { IContextMenuItemConfig } from "@/src/components/ui/context-menu/types"
|
||||
import { views } from "@/src/constants/views"
|
||||
import { getFeed } from "@/src/store/feed/getter"
|
||||
import { getSubscription } from "@/src/store/subscription/getter"
|
||||
@@ -17,44 +12,89 @@ import { useListSubscriptionCategory } from "@/src/store/subscription/hooks"
|
||||
import { subscriptionSyncService } from "@/src/store/subscription/store"
|
||||
import { unreadSyncService } from "@/src/store/unread/store"
|
||||
|
||||
enum FeedItemActionKey {
|
||||
MARK_ALL_AS_READ = "markAllAsRead",
|
||||
CLAIM = "claim",
|
||||
BOOST = "boost",
|
||||
ADD_TO_CATEGORY = "addToCategory",
|
||||
CREATE_NEW_CATEGORY = "createNewCategory",
|
||||
EDIT = "edit",
|
||||
COPY_LINK = "copyLink",
|
||||
UNSUBSCRIBE = "unsubscribe",
|
||||
|
||||
CHANGE_TO_OTHER_VIEW = "changeToOtherView",
|
||||
|
||||
DELETE = "delete",
|
||||
}
|
||||
|
||||
enum ChangeToOtherViewActionKey {
|
||||
ARTICLE = "article",
|
||||
SOCIAL = "social",
|
||||
PICTURE = "picture",
|
||||
VIDEO = "video",
|
||||
NOTIFICATION = "notification",
|
||||
AUDIO = "audio",
|
||||
}
|
||||
const changeViewActionKeyMapping: Record<FeedViewType, ChangeToOtherViewActionKey> = {
|
||||
[FeedViewType.Articles]: ChangeToOtherViewActionKey.ARTICLE,
|
||||
[FeedViewType.SocialMedia]: ChangeToOtherViewActionKey.SOCIAL,
|
||||
[FeedViewType.Pictures]: ChangeToOtherViewActionKey.PICTURE,
|
||||
[FeedViewType.Videos]: ChangeToOtherViewActionKey.VIDEO,
|
||||
[FeedViewType.Notifications]: ChangeToOtherViewActionKey.NOTIFICATION,
|
||||
[FeedViewType.Audios]: ChangeToOtherViewActionKey.AUDIO,
|
||||
} as const
|
||||
type Options = {
|
||||
categories: string[]
|
||||
}
|
||||
const createFeedItemActions: (options: Options) => ContextMenuAction[] = (options) => {
|
||||
const createFeedItemActions: (options: Options) => IContextMenuItemConfig[] = (options) => {
|
||||
return [
|
||||
{
|
||||
title: "Mark All As Read",
|
||||
actionKey: FeedItemActionKey.MARK_ALL_AS_READ,
|
||||
},
|
||||
{
|
||||
title: "Claim",
|
||||
actionKey: FeedItemActionKey.CLAIM,
|
||||
},
|
||||
{
|
||||
title: "Boost",
|
||||
actionKey: FeedItemActionKey.BOOST,
|
||||
},
|
||||
{
|
||||
title: "Add To Category",
|
||||
actions: [
|
||||
...options.categories.map((category) => ({
|
||||
title: category,
|
||||
})),
|
||||
{
|
||||
title: "Create New Category",
|
||||
systemIcon: "plus",
|
||||
},
|
||||
],
|
||||
actionKey: FeedItemActionKey.ADD_TO_CATEGORY,
|
||||
subMenu: {
|
||||
title: "Add To Category",
|
||||
items: [
|
||||
...options.categories.map((category) => ({
|
||||
title: category,
|
||||
actionKey: `${FeedItemActionKey.ADD_TO_CATEGORY}:${category}`,
|
||||
})),
|
||||
{
|
||||
title: "Create New Category",
|
||||
actionKey: FeedItemActionKey.CREATE_NEW_CATEGORY,
|
||||
|
||||
systemIcon: "plus",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Edit",
|
||||
actionKey: FeedItemActionKey.EDIT,
|
||||
},
|
||||
{
|
||||
title: "Copy Link",
|
||||
actionKey: FeedItemActionKey.COPY_LINK,
|
||||
},
|
||||
{
|
||||
title: "Unsubscribe",
|
||||
actionKey: FeedItemActionKey.UNSUBSCRIBE,
|
||||
destructive: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export const SubscriptionFeedItemContextMenu: FC<
|
||||
PropsWithChildren & {
|
||||
id: string
|
||||
@@ -69,55 +109,36 @@ export const SubscriptionFeedItemContextMenu: FC<
|
||||
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={actions}
|
||||
onPress={useEventCallback((e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>) => {
|
||||
const [first, second] = e.nativeEvent.indexPath
|
||||
|
||||
switch (first) {
|
||||
case 0: {
|
||||
config={{
|
||||
items: actions,
|
||||
}}
|
||||
onPressMenuItem={(item) => {
|
||||
switch (item.actionKey) {
|
||||
case FeedItemActionKey.MARK_ALL_AS_READ: {
|
||||
unreadSyncService.markAsRead(id)
|
||||
break
|
||||
}
|
||||
case 1: {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
case 2: {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
case 3: {
|
||||
// add to category
|
||||
|
||||
if (!actions[3].actions) break
|
||||
const newCategory = second === actions[3].actions.length - 1
|
||||
case FeedItemActionKey.CREATE_NEW_CATEGORY: {
|
||||
// create new category
|
||||
const subscription = getSubscription(id)
|
||||
|
||||
if (!subscription) return
|
||||
if (newCategory) {
|
||||
// create new category
|
||||
Alert.prompt("Create New Category", "Enter the name of the new category", (text) => {
|
||||
subscriptionSyncService.edit({
|
||||
...subscription,
|
||||
category: text,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// add to category
|
||||
Alert.prompt("Create New Category", "Enter the name of the new category", (text) => {
|
||||
subscriptionSyncService.edit({
|
||||
...subscription,
|
||||
category: actions[3].actions[second].title,
|
||||
category: text,
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
break
|
||||
}
|
||||
case 4: {
|
||||
// edit
|
||||
case FeedItemActionKey.CLAIM: {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
case 5: {
|
||||
// copy link
|
||||
case FeedItemActionKey.BOOST: {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
case FeedItemActionKey.COPY_LINK: {
|
||||
const subscription = getSubscription(id)
|
||||
if (!subscription) return
|
||||
|
||||
@@ -132,10 +153,9 @@ export const SubscriptionFeedItemContextMenu: FC<
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case 6: {
|
||||
case FeedItemActionKey.UNSUBSCRIBE: {
|
||||
// unsubscribe
|
||||
Alert.alert("Unsubscribe?", "This will remove the feed from your list", [
|
||||
Alert.alert("Unsubscribe?", "This will remove the feed from your subscriptions", [
|
||||
{
|
||||
text: "Cancel",
|
||||
style: "cancel",
|
||||
@@ -148,10 +168,26 @@ export const SubscriptionFeedItemContextMenu: FC<
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
})}
|
||||
|
||||
if (item.actionKey.startsWith(FeedItemActionKey.ADD_TO_CATEGORY)) {
|
||||
const category = item.actionKey.split(":")[1]
|
||||
if (!category) return
|
||||
|
||||
const subscription = getSubscription(id)
|
||||
|
||||
if (!subscription) return
|
||||
|
||||
// add to category
|
||||
subscriptionSyncService.edit({
|
||||
...subscription,
|
||||
category,
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ContextMenu>
|
||||
@@ -162,59 +198,80 @@ export const SubscriptionFeedCategoryContextMenu: FC<
|
||||
{
|
||||
category: string
|
||||
feedIds: string[]
|
||||
view: FeedViewType
|
||||
} & PropsWithChildren
|
||||
> = ({ category: _, feedIds, children }) => {
|
||||
> = ({ category: _, feedIds, view: currentView, children }) => {
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={useMemo(
|
||||
() => [
|
||||
config={{
|
||||
items: [
|
||||
{
|
||||
title: "Mark All As Read",
|
||||
actionKey: FeedItemActionKey.MARK_ALL_AS_READ,
|
||||
},
|
||||
{
|
||||
title: "Change To Other View",
|
||||
actions: views.map((view) => ({
|
||||
title: view.name,
|
||||
})),
|
||||
actionKey: FeedItemActionKey.CHANGE_TO_OTHER_VIEW,
|
||||
subMenu: {
|
||||
title: "Change To Other View",
|
||||
items: views.map((view) => ({
|
||||
title: view.name,
|
||||
actionKey: changeViewActionKeyMapping[view.view],
|
||||
checked: view.view === currentView,
|
||||
})),
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Edit Category",
|
||||
actionKey: FeedItemActionKey.EDIT,
|
||||
},
|
||||
{
|
||||
title: "Delete Category",
|
||||
actionKey: FeedItemActionKey.DELETE,
|
||||
destructive: true,
|
||||
},
|
||||
],
|
||||
[],
|
||||
)}
|
||||
onPress={useCallback(
|
||||
(e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>) => {
|
||||
const { name } = e.nativeEvent
|
||||
const [first, second] = e.nativeEvent.indexPath
|
||||
|
||||
if (first === 1) {
|
||||
void second
|
||||
// TODO change to other view
|
||||
return
|
||||
}}
|
||||
onPressMenuItem={(item) => {
|
||||
switch (item.actionKey) {
|
||||
case FeedItemActionKey.MARK_ALL_AS_READ: {
|
||||
unreadSyncService.markAsReadMany(feedIds)
|
||||
break
|
||||
}
|
||||
switch (name) {
|
||||
case "Mark All As Read": {
|
||||
unreadSyncService.markAsReadMany(feedIds)
|
||||
break
|
||||
}
|
||||
case "Change To Other View": {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
|
||||
case "Delete Category": {
|
||||
// TODO: implement logic
|
||||
break
|
||||
}
|
||||
case ChangeToOtherViewActionKey.ARTICLE: {
|
||||
// TODO: change to article view
|
||||
break
|
||||
}
|
||||
},
|
||||
[feedIds],
|
||||
)}
|
||||
case ChangeToOtherViewActionKey.SOCIAL: {
|
||||
// TODO: change to social view
|
||||
break
|
||||
}
|
||||
case ChangeToOtherViewActionKey.PICTURE: {
|
||||
// TODO: change to picture view
|
||||
break
|
||||
}
|
||||
case ChangeToOtherViewActionKey.VIDEO: {
|
||||
// TODO: change to video view
|
||||
break
|
||||
}
|
||||
case ChangeToOtherViewActionKey.NOTIFICATION: {
|
||||
// TODO: change to notification view
|
||||
break
|
||||
}
|
||||
case ChangeToOtherViewActionKey.AUDIO: {
|
||||
// TODO: change to audio view
|
||||
break
|
||||
}
|
||||
case FeedItemActionKey.EDIT: {
|
||||
// TODO: edit category
|
||||
break
|
||||
}
|
||||
case FeedItemActionKey.DELETE: {
|
||||
// TODO: delete category
|
||||
break
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ContextMenu>
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { useMemo } from "react"
|
||||
import type { NativeSyntheticEvent } from "react-native"
|
||||
import { Alert, Clipboard } from "react-native"
|
||||
import type {
|
||||
ContextMenuAction,
|
||||
ContextMenuOnPressNativeEvent,
|
||||
} from "react-native-context-menu-view"
|
||||
import { useEventCallback } from "usehooks-ts"
|
||||
|
||||
import { ContextMenu } from "@/src/components/ui/context-menu"
|
||||
import type { NullableContextMenuItemConfig } from "@/src/components/ui/context-menu/types"
|
||||
import { getWebUrl } from "@/src/lib/env"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
import { getList } from "@/src/store/list/getters"
|
||||
import { useIsOwnList } from "@/src/store/list/hooks"
|
||||
import { subscriptionSyncService } from "@/src/store/subscription/store"
|
||||
|
||||
enum ListItemActionKey {
|
||||
EDIT = "edit",
|
||||
COPY_LINK = "copyLink",
|
||||
UNSUBSCRIBE = "unsubscribe",
|
||||
}
|
||||
export const SubscriptionListItemContextMenu: FC<
|
||||
PropsWithChildren & {
|
||||
id: string
|
||||
@@ -21,39 +22,40 @@ export const SubscriptionListItemContextMenu: FC<
|
||||
> = ({ id, children }) => {
|
||||
const isOwnList = useIsOwnList(id)
|
||||
const actions = useMemo(
|
||||
() =>
|
||||
[
|
||||
isOwnList && {
|
||||
title: "Edit",
|
||||
},
|
||||
{
|
||||
title: "Copy Link",
|
||||
},
|
||||
{
|
||||
title: "Unsubscribe",
|
||||
destructive: true,
|
||||
},
|
||||
].filter(Boolean) as ContextMenuAction[],
|
||||
(): NullableContextMenuItemConfig[] => [
|
||||
isOwnList && {
|
||||
title: "Edit",
|
||||
actionKey: ListItemActionKey.EDIT,
|
||||
},
|
||||
{
|
||||
title: "Copy Link",
|
||||
actionKey: ListItemActionKey.COPY_LINK,
|
||||
},
|
||||
{
|
||||
title: "Unsubscribe",
|
||||
actionKey: ListItemActionKey.UNSUBSCRIBE,
|
||||
destructive: true,
|
||||
},
|
||||
],
|
||||
[isOwnList],
|
||||
)
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={actions}
|
||||
onPress={useEventCallback((e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>) => {
|
||||
const { name } = e.nativeEvent
|
||||
|
||||
switch (name) {
|
||||
case "Edit": {
|
||||
config={{ items: actions }}
|
||||
onPressMenuItem={(item) => {
|
||||
switch (item.actionKey) {
|
||||
case ListItemActionKey.EDIT: {
|
||||
// TODO: implement
|
||||
break
|
||||
}
|
||||
case "Copy Link": {
|
||||
case ListItemActionKey.COPY_LINK: {
|
||||
const list = getList(id)
|
||||
if (!list) return
|
||||
toast.info("Link copied to clipboard")
|
||||
Clipboard.setString(`${getWebUrl()}/share/lists/${list.id}`)
|
||||
break
|
||||
}
|
||||
case "Unsubscribe": {
|
||||
case ListItemActionKey.UNSUBSCRIBE: {
|
||||
Alert.alert("Unsubscribe", "Are you sure you want to unsubscribe?", [
|
||||
{
|
||||
text: "Cancel",
|
||||
@@ -70,7 +72,7 @@ export const SubscriptionListItemContextMenu: FC<
|
||||
break
|
||||
}
|
||||
}
|
||||
})}
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ContextMenu>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { router } from "expo-router"
|
||||
import type { FC } from "react"
|
||||
import { memo, useMemo } from "react"
|
||||
import { Clipboard, Linking, Text, TouchableOpacity, View } from "react-native"
|
||||
import WebView from "react-native-webview"
|
||||
|
||||
import { ContextMenu } from "@/src/components/ui/context-menu"
|
||||
import { Grid } from "@/src/components/ui/grid"
|
||||
@@ -11,6 +12,11 @@ import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
|
||||
import { RSSHubCategoryCopyMap } from "./copy"
|
||||
|
||||
enum RecommendationListItemActionKey {
|
||||
COPY_MAINTAINER_NAME = "copyMaintainerName",
|
||||
OPEN_MAINTAINER_PROFILE = "openMaintainerProfile",
|
||||
}
|
||||
|
||||
export const RecommendationListItem: FC<{
|
||||
data: RSSHubRouteDeclaration
|
||||
routePrefix: string
|
||||
@@ -46,21 +52,28 @@ export const RecommendationListItem: FC<{
|
||||
{maintainers.map((m) => (
|
||||
<ContextMenu
|
||||
key={m}
|
||||
actions={[
|
||||
{
|
||||
title: "Copy Maintainer Name",
|
||||
},
|
||||
{
|
||||
title: "Open Maintainer's Profile",
|
||||
},
|
||||
]}
|
||||
onPress={(e) => {
|
||||
switch (e.nativeEvent.index) {
|
||||
case 0: {
|
||||
renderPreview={() => {
|
||||
return <WebView source={{ uri: `https://github.com/${m}` }} />
|
||||
}}
|
||||
config={{
|
||||
items: [
|
||||
{
|
||||
title: "Copy Maintainer Name",
|
||||
actionKey: RecommendationListItemActionKey.COPY_MAINTAINER_NAME,
|
||||
},
|
||||
{
|
||||
title: "Open Maintainer's Profile",
|
||||
actionKey: RecommendationListItemActionKey.OPEN_MAINTAINER_PROFILE,
|
||||
},
|
||||
],
|
||||
}}
|
||||
onPressMenuItem={(e) => {
|
||||
switch (e.actionKey) {
|
||||
case RecommendationListItemActionKey.COPY_MAINTAINER_NAME: {
|
||||
Clipboard.setString(m)
|
||||
break
|
||||
}
|
||||
case 1: {
|
||||
case RecommendationListItemActionKey.OPEN_MAINTAINER_PROFILE: {
|
||||
Linking.openURL(`https://github.com/${m}`)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -124,12 +124,7 @@ const SearchFeedItem = memo(({ item }: { item: SearchResultItem }) => {
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerClassName="flex flex-row gap-4 pl-14 pr-2"
|
||||
>
|
||||
{item.entries?.map((entry) => (
|
||||
// <View key={entry.id} className="bg-green h-[60px] w-[3/4]">
|
||||
// <Text>{entry.title}</Text>
|
||||
// </View>
|
||||
<PreviewItem entry={entry} key={entry.id} />
|
||||
))}
|
||||
{item.entries?.map((entry) => <PreviewItem entry={entry} key={entry.id} />)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
</ItemPressable>
|
||||
|
||||
@@ -56,10 +56,7 @@ const DiscoverHeaderImpl = () => {
|
||||
const headerHeight = getDefaultHeaderHeight(frame, false, insets.top)
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{ height: headerHeight, paddingTop: insets.top }}
|
||||
className="border-b-separator relative border-b"
|
||||
>
|
||||
<View style={{ height: headerHeight, paddingTop: insets.top }} className="relative">
|
||||
<BlurEffect />
|
||||
<View style={styles.header}>
|
||||
<PlaceholerSearchBar />
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MingcuteRightLine } from "@/src/icons/mingcute_right_line"
|
||||
import { useUnreadCounts } from "@/src/store/unread/hooks"
|
||||
|
||||
import { SubscriptionFeedCategoryContextMenu } from "../context-menu/feeds"
|
||||
import { GroupedContext } from "./ctx"
|
||||
import { GroupedContext, useViewPageCurrentView } from "./ctx"
|
||||
import { UnGroupedList } from "./UnGroupedList"
|
||||
|
||||
// const CategoryList: FC<{
|
||||
@@ -28,9 +28,15 @@ export const CategoryGrouped = memo(
|
||||
transform: [{ rotate: `${rotateSharedValue.value}deg` }],
|
||||
}
|
||||
}, [rotateSharedValue])
|
||||
const view = useViewPageCurrentView()
|
||||
|
||||
return (
|
||||
<>
|
||||
<SubscriptionFeedCategoryContextMenu category={category} feedIds={subscriptionIds}>
|
||||
<SubscriptionFeedCategoryContextMenu
|
||||
category={category}
|
||||
feedIds={subscriptionIds}
|
||||
view={view}
|
||||
>
|
||||
<ItemPressable
|
||||
onPress={() => {
|
||||
// TODO navigate to category
|
||||
|
||||
@@ -119,10 +119,11 @@ const TabItem = memo(
|
||||
const unreadCount = useUnreadCountByView(view.view)
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[{ title: "Mark all as read" }]}
|
||||
onPress={(e) => {
|
||||
switch (e.nativeEvent.index) {
|
||||
case 0: {
|
||||
// actions={[{ title: "Mark all as read" }]}
|
||||
config={{ items: [{ title: "Mark all as read", actionKey: "markAllAsRead" }] }}
|
||||
onPressMenuItem={(e) => {
|
||||
switch (e.actionKey) {
|
||||
case "markAllAsRead": {
|
||||
unreadSyncService.markViewAsRead(view.view)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TouchableOpacity } from "react-native"
|
||||
import type { ContextMenuAction } from "react-native-context-menu-view"
|
||||
import ContextMenu from "react-native-context-menu-view"
|
||||
|
||||
import { ContextMenu } from "@/src/components/ui/context-menu"
|
||||
import { AZSortAscendingLettersCuteReIcon } from "@/src/icons/AZ_sort_ascending_letters_cute_re"
|
||||
import { AZSortDescendingLettersCuteReIcon } from "@/src/icons/AZ_sort_descending_letters_cute_re"
|
||||
import { Numbers90SortAscendingCuteReIcon } from "@/src/icons/numbers_90_sort_ascending_cute_re"
|
||||
|
||||
Generated
+36
@@ -556,6 +556,12 @@ importers:
|
||||
react-native-gesture-handler:
|
||||
specifier: ~2.20.2
|
||||
version: 2.20.2(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1)
|
||||
react-native-ios-context-menu:
|
||||
specifier: 3.1.0
|
||||
version: 3.1.0(react-native-ios-utilities@5.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1))(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1)
|
||||
react-native-ios-utilities:
|
||||
specifier: 5.1.0
|
||||
version: 5.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1)
|
||||
react-native-keyboard-controller:
|
||||
specifier: ^1.15.0
|
||||
version: 1.15.0(react-native-reanimated@3.16.5(@babel/core@7.26.0)(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1))(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1)
|
||||
@@ -2270,6 +2276,9 @@ packages:
|
||||
peerDependencies:
|
||||
react: '>=16.8.0'
|
||||
|
||||
'@dominicstop/ts-event-emitter@1.1.0':
|
||||
resolution: {integrity: sha512-CcxmJIvUb1vsFheuGGVSQf4KdPZC44XolpUT34+vlal+LyQoBUOn31pjFET5M9ctOxEpt8xa0M3/2M7uUiAoJw==}
|
||||
|
||||
'@drizzle-team/brocli@0.10.2':
|
||||
resolution: {integrity: sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==}
|
||||
|
||||
@@ -12345,6 +12354,19 @@ packages:
|
||||
peerDependencies:
|
||||
react: ^16.6.0 || ^17.0.0 || ^18.0.0
|
||||
|
||||
react-native-ios-context-menu@3.1.0:
|
||||
resolution: {integrity: sha512-qdPSXMKUp5lDgmZeUPdv5sgBFhkFrIqma+zsnqJQYOvekb6Qs17yJy1Rqhrj0bJrwuduHzZX0aYbaA8whxqpDw==}
|
||||
peerDependencies:
|
||||
react: '*'
|
||||
react-native: '*'
|
||||
react-native-ios-utilities: '*'
|
||||
|
||||
react-native-ios-utilities@5.1.0:
|
||||
resolution: {integrity: sha512-25QqdENHyMdlT48Xkr5hEke1yfGbbGk6Wy+hM5jFPlfXDmGgF/QicGN4SiQXIbSLWuMqFHVVoiJ2vkQ8ARP5mg==}
|
||||
peerDependencies:
|
||||
react: '*'
|
||||
react-native: '*'
|
||||
|
||||
react-native-is-edge-to-edge@1.1.6:
|
||||
resolution: {integrity: sha512-1pHnFTlBahins6UAajXUqeCOHew9l9C2C8tErnpGC3IyLJzvxD+TpYAixnCbrVS52f7+NvMttbiSI290XfwN0w==}
|
||||
peerDependencies:
|
||||
@@ -15766,6 +15788,8 @@ snapshots:
|
||||
react: 18.3.1
|
||||
tslib: 2.8.1
|
||||
|
||||
'@dominicstop/ts-event-emitter@1.1.0': {}
|
||||
|
||||
'@drizzle-team/brocli@0.10.2': {}
|
||||
|
||||
'@edge-runtime/format@2.2.1': {}
|
||||
@@ -28354,6 +28378,18 @@ snapshots:
|
||||
react-fast-compare: 3.2.2
|
||||
shallowequal: 1.1.0
|
||||
|
||||
react-native-ios-context-menu@3.1.0(react-native-ios-utilities@5.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1))(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1):
|
||||
dependencies:
|
||||
'@dominicstop/ts-event-emitter': 1.1.0
|
||||
react: 18.3.1
|
||||
react-native: 0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)
|
||||
react-native-ios-utilities: 5.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1)
|
||||
|
||||
react-native-ios-utilities@5.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1):
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
react-native: 0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)
|
||||
|
||||
react-native-is-edge-to-edge@1.1.6(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1):
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
|
||||
Reference in New Issue
Block a user