Skip to content

Commit

Permalink
fix: remove context menu for entry title
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Aug 17, 2024
1 parent 8b43bab commit 33899a1
Showing 1 changed file with 14 additions and 53 deletions.
67 changes: 14 additions & 53 deletions app/(app)/feed/detail/[entryId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as Sharing from 'expo-sharing'
import { useAtom, useAtomValue, useSetAtom } from 'jotai'
import { useEffect, useMemo, useRef } from 'react'
import { FlatList, Pressable, View } from 'react-native'
import ContextMenu from 'react-native-context-menu-view'
import PagerView from 'react-native-pager-view'
import Animated, { FadeIn, runOnJS, SlideInDown, SlideOutDown, useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
Expand Down Expand Up @@ -364,60 +363,22 @@ function EntryDetail({ entry, readHistories }: { entry: Entry, readHistories?: E
))}
</PagerView>
)}
<ContextMenu
actions={
entry.url
? [
{ title: 'Copy Link', systemIcon: 'doc.on.doc' },
{ title: 'Open Link', systemIcon: 'safari' },
{ title: 'Open Link in Browser', systemIcon: 'safari' },
{ title: 'Share', systemIcon: 'square.and.arrow.up' },
]
: []
}
onPress={(e) => {
switch (e.nativeEvent.name) {
case 'Copy Link': {
Clipboard.setStringAsync(entry.url!)
.then(() => {
Toast.show('Copied to clipboard', { type: 'success' })
})
.catch(console.error)

break
}
case 'Open Link in Browser': case 'Open Link': {
openExternalUrl(entry.url, { inApp: e.nativeEvent.name === 'Open Link' })
.catch(console.error)

break
}
case 'Share': {
Sharing.shareAsync(entry.url!)
.catch(console.error)

break
}
}
<Text
size={24}
weight={600}
style={{
textDecorationLine: 'underline',
marginBottom: 8,
paddingHorizontal: 15,
marginVertical: 15,
}}
onPress={() => {
openExternalUrl(entry.url)
.catch(console.error)
}}
>
<Text
size={24}
weight={600}
style={{
textDecorationLine: 'underline',
marginBottom: 8,
paddingHorizontal: 15,
marginVertical: 15,
}}
onPress={() => {
openExternalUrl(entry.url)
.catch(console.error)
}}
>
{entry?.title}
</Text>
</ContextMenu>
{entry?.title}
</Text>
{entry.author && (
<Text style={{ paddingHorizontal: 15 }}>
{entry.author}
Expand Down

0 comments on commit 33899a1

Please sign in to comment.