From 99bcf967f5ea8fd22da816c5e8efe2ddc672ea80 Mon Sep 17 00:00:00 2001 From: Dylan Jeffers Date: Mon, 6 May 2024 23:06:22 -0700 Subject: [PATCH 1/2] [QA-955] Dismiss keyboard when clicking external link --- packages/mobile/src/components/core/Hyperlink.tsx | 6 ++++-- .../mobile/src/screens/chat-screen/ChatMessageListItem.tsx | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/mobile/src/components/core/Hyperlink.tsx b/packages/mobile/src/components/core/Hyperlink.tsx index d685cbafa48..cabcd68d87c 100644 --- a/packages/mobile/src/components/core/Hyperlink.tsx +++ b/packages/mobile/src/components/core/Hyperlink.tsx @@ -58,6 +58,7 @@ export const Hyperlink = (props: HyperlinkProps) => { source, styles: stylesProp, style, + onPress, ...other } = props const styles = useStyles() @@ -104,7 +105,8 @@ export const Hyperlink = (props: HyperlinkProps) => { const { onOpen: openLeavingAudiusModal } = useLeavingAudiusModal() const handlePress = useCallback( - (url: string) => { + (url: string, _match: Match) => { + onPress?.(url, _match) if (isInteralAudiusUrl(url)) { const path = getPathFromAudiusUrl(url) if (path) { @@ -116,7 +118,7 @@ export const Hyperlink = (props: HyperlinkProps) => { openLeavingAudiusModal({ link: url }) } }, - [linkTo, openLink, openLeavingAudiusModal] + [onPress, linkTo, openLink, openLeavingAudiusModal] ) const renderLink = useCallback( diff --git a/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx b/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx index b44e60c03e4..aabb387dc26 100644 --- a/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx +++ b/packages/mobile/src/screens/chat-screen/ChatMessageListItem.tsx @@ -12,7 +12,7 @@ import { import type { ChatMessageReaction } from '@audius/sdk' import { find } from 'linkifyjs' import type { ViewStyle, StyleProp } from 'react-native' -import { Dimensions, View } from 'react-native' +import { Dimensions, Keyboard, View } from 'react-native' import { useSelector } from 'react-redux' import ChatTail from 'app/assets/images/ChatTail.svg' @@ -322,6 +322,7 @@ export const ChatMessageListItem = memo(function ChatMessageListItem( ]} > Date: Tue, 7 May 2024 10:46:27 -0700 Subject: [PATCH 2/2] Fix verify --- packages/mobile/src/components/core/Hyperlink.tsx | 2 +- .../src/harmony-native/components/input/TextInput/types.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mobile/src/components/core/Hyperlink.tsx b/packages/mobile/src/components/core/Hyperlink.tsx index cabcd68d87c..4383b1a34f8 100644 --- a/packages/mobile/src/components/core/Hyperlink.tsx +++ b/packages/mobile/src/components/core/Hyperlink.tsx @@ -184,7 +184,7 @@ export const Hyperlink = (props: HyperlinkProps) => { left: linkLayout.x - linkContainerLayout.x } ]} - onPress={() => handlePress(match.getAnchorHref())} + onPress={() => handlePress(match.getAnchorHref(), match)} > {text} diff --git a/packages/mobile/src/harmony-native/components/input/TextInput/types.ts b/packages/mobile/src/harmony-native/components/input/TextInput/types.ts index 0cde8855089..6065944feaf 100644 --- a/packages/mobile/src/harmony-native/components/input/TextInput/types.ts +++ b/packages/mobile/src/harmony-native/components/input/TextInput/types.ts @@ -31,6 +31,7 @@ type InternalProps = { } export type TextInputProps = RNTextInputProps & { + id?: string /** * Input sizes. NOTE: small inputs will not show the label * @default default