Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use `useOpenLink` hook for links in ALF (#2975)

* use `useOpenLink` hook for links in ALF

* web only for `outline`

authored by

Hailey and committed by
GitHub
35be8ec9 894f00d6

+13 -10
+13 -10
src/components/Link.tsx
··· 1 1 import React from 'react' 2 - import {GestureResponderEvent, Linking} from 'react-native' 2 + import {GestureResponderEvent} from 'react-native' 3 3 import { 4 4 useLinkProps, 5 5 useNavigation, ··· 20 20 import {useModalControls} from '#/state/modals' 21 21 import {router} from '#/routes' 22 22 import {Text, TextProps} from '#/components/Typography' 23 + import {useOpenLink} from 'state/preferences/in-app-browser' 23 24 24 25 /** 25 26 * Only available within a `Link`, since that inherits from `Button`. ··· 80 81 }) 81 82 const isExternal = isExternalUrl(href) 82 83 const {openModal, closeModal} = useModalControls() 84 + const openLink = useOpenLink() 83 85 84 86 const onPress = React.useCallback( 85 87 (e: GestureResponderEvent) => { ··· 106 108 e.preventDefault() 107 109 108 110 if (isExternal) { 109 - Linking.openURL(href) 111 + openLink(href) 110 112 } else { 111 113 /** 112 114 * A `GestureResponderEvent`, but cast to `any` to avoid using a bunch ··· 124 126 href.startsWith('http') || 125 127 href.startsWith('mailto') 126 128 ) { 127 - Linking.openURL(href) 129 + openLink(href) 128 130 } else { 129 131 closeModal() // close any active modals 130 132 ··· 145 147 } 146 148 }, 147 149 [ 148 - href, 149 - isExternal, 150 + outerOnPress, 150 151 warnOnMismatchingTextChild, 151 - navigation, 152 - action, 153 152 displayText, 153 + isExternal, 154 + href, 155 + openModal, 156 + openLink, 154 157 closeModal, 155 - openModal, 156 - outerOnPress, 158 + action, 159 + navigation, 157 160 ], 158 161 ) 159 162 ··· 260 263 style={[ 261 264 {color: t.palette.primary_500}, 262 265 (hovered || focused || pressed) && { 263 - outline: 0, 266 + ...web({outline: 0}), 264 267 textDecorationLine: 'underline', 265 268 textDecorationColor: flattenedStyle.color ?? t.palette.primary_500, 266 269 },