Replace `isDesktop` with `isWeb` in `DesktopWebTextLink` component

- Replaced `useWebMediaQueries().isDesktop` with `isWeb` in `DesktopWebTextLink` component to fix inconsistent behavior due to media query changes.
- `isWeb` doesn't rely on media queries, offering stable judgement and avoiding fluctuation when adjusting the browser window.
zio/stable
Bryan Lee 2023-10-01 21:17:18 +08:00
parent a76fb78d53
commit 2ca673d7f5
No known key found for this signature in database
GPG Key ID: AA996124D88BE937
1 changed files with 2 additions and 5 deletions

View File

@ -28,11 +28,10 @@ import {
isExternalUrl, isExternalUrl,
linkRequiresWarning, linkRequiresWarning,
} from 'lib/strings/url-helpers' } from 'lib/strings/url-helpers'
import {isAndroid} from 'platform/detection' import {isAndroid, isWeb} from 'platform/detection'
import {sanitizeUrl} from '@braintree/sanitize-url' import {sanitizeUrl} from '@braintree/sanitize-url'
import {PressableWithHover} from './PressableWithHover' import {PressableWithHover} from './PressableWithHover'
import FixedTouchableHighlight from '../pager/FixedTouchableHighlight' import FixedTouchableHighlight from '../pager/FixedTouchableHighlight'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
type Event = type Event =
| React.MouseEvent<HTMLAnchorElement, MouseEvent> | React.MouseEvent<HTMLAnchorElement, MouseEvent>
@ -246,9 +245,7 @@ export const DesktopWebTextLink = observer(function DesktopWebTextLink({
lineHeight, lineHeight,
...props ...props
}: DesktopWebTextLinkProps) { }: DesktopWebTextLinkProps) {
const {isDesktop} = useWebMediaQueries() if (isWeb) {
if (isDesktop) {
return ( return (
<TextLink <TextLink
testID={testID} testID={testID}