🐛 Handle middle mouse click on feed list items (#1469)
* 🐛 Handle middle mouse click on feed list items * ♻️ Refactor the event listener and turn it into a dedicated hook for web * 🧹 Cleanup unnecessary Link changes * Fix import * Create native version of useAuxClick --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
parent
255beb0c1f
commit
3c4899b3c4
4 changed files with 50 additions and 2 deletions
|
@ -59,6 +59,7 @@ export const Link = observer(function Link({
|
|||
}: Props) {
|
||||
const store = useStores()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
const anchorHref = asAnchor ? sanitizeUrl(href) : undefined
|
||||
|
||||
const onPress = React.useCallback(
|
||||
(e?: Event) => {
|
||||
|
@ -96,7 +97,7 @@ export const Link = observer(function Link({
|
|||
accessibilityRole="link"
|
||||
{...props}>
|
||||
{/* @ts-ignore web only -prf */}
|
||||
<View style={style} href={asAnchor ? sanitizeUrl(href) : undefined}>
|
||||
<View style={style} href={anchorHref}>
|
||||
{children ? children : <Text>{title || 'link'}</Text>}
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
|
@ -123,7 +124,7 @@ export const Link = observer(function Link({
|
|||
accessible={accessible}
|
||||
accessibilityRole="link"
|
||||
// @ts-ignore web only -prf
|
||||
href={asAnchor ? sanitizeUrl(href) : undefined}
|
||||
href={anchorHref}
|
||||
{...props}>
|
||||
{children ? children : <Text>{title || 'link'}</Text>}
|
||||
</Com>
|
||||
|
|
|
@ -16,11 +16,13 @@ import {useWebMediaQueries} from '../../lib/hooks/useWebMediaQueries'
|
|||
import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
|
||||
import {useNavigation} from '@react-navigation/native'
|
||||
import {NavigationProp} from 'lib/routes/types'
|
||||
import {useAuxClick} from 'lib/hooks/useAuxClick'
|
||||
|
||||
const ShellInner = observer(function ShellInnerImpl() {
|
||||
const store = useStores()
|
||||
const {isDesktop, isMobile} = useWebMediaQueries()
|
||||
const navigator = useNavigation<NavigationProp>()
|
||||
useAuxClick()
|
||||
|
||||
useEffect(() => {
|
||||
navigator.addListener('state', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue