diff options
Diffstat (limited to 'src/view/com/util/Link.tsx')
-rw-r--r-- | src/view/com/util/Link.tsx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/view/com/util/Link.tsx b/src/view/com/util/Link.tsx index 6915d3e08..1777f6659 100644 --- a/src/view/com/util/Link.tsx +++ b/src/view/com/util/Link.tsx @@ -1,5 +1,4 @@ -import React, {ComponentProps, useMemo} from 'react' -import {observer} from 'mobx-react-lite' +import React, {ComponentProps, memo, useMemo} from 'react' import { Linking, GestureResponderEvent, @@ -28,11 +27,10 @@ import { isExternalUrl, linkRequiresWarning, } from 'lib/strings/url-helpers' -import {isAndroid} from 'platform/detection' +import {isAndroid, isWeb} from 'platform/detection' import {sanitizeUrl} from '@braintree/sanitize-url' import {PressableWithHover} from './PressableWithHover' import FixedTouchableHighlight from '../pager/FixedTouchableHighlight' -import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' type Event = | React.MouseEvent<HTMLAnchorElement, MouseEvent> @@ -50,7 +48,7 @@ interface Props extends ComponentProps<typeof TouchableOpacity> { anchorNoUnderline?: boolean } -export const Link = observer(function Link({ +export const Link = memo(function Link({ testID, style, href, @@ -136,7 +134,7 @@ export const Link = observer(function Link({ ) }) -export const TextLink = observer(function TextLink({ +export const TextLink = memo(function TextLink({ testID, type = 'md', style, @@ -223,7 +221,7 @@ export const TextLink = observer(function TextLink({ /** * Only acts as a link on desktop web */ -interface DesktopWebTextLinkProps extends TextProps { +interface TextLinkOnWebOnlyProps extends TextProps { testID?: string type?: TypographyVariant style?: StyleProp<TextStyle> @@ -236,7 +234,7 @@ interface DesktopWebTextLinkProps extends TextProps { accessibilityHint?: string title?: string } -export const DesktopWebTextLink = observer(function DesktopWebTextLink({ +export const TextLinkOnWebOnly = memo(function DesktopWebTextLink({ testID, type = 'md', style, @@ -245,10 +243,8 @@ export const DesktopWebTextLink = observer(function DesktopWebTextLink({ numberOfLines, lineHeight, ...props -}: DesktopWebTextLinkProps) { - const {isDesktop} = useWebMediaQueries() - - if (isDesktop) { +}: TextLinkOnWebOnlyProps) { + if (isWeb) { return ( <TextLink testID={testID} |