Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA-955] Dismiss keyboard when clicking external link #8375

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/mobile/src/components/core/Hyperlink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const Hyperlink = (props: HyperlinkProps) => {
source,
styles: stylesProp,
style,
onPress,
...other
} = props
const styles = useStyles()
Expand Down Expand Up @@ -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) {
Expand All @@ -116,7 +118,7 @@ export const Hyperlink = (props: HyperlinkProps) => {
openLeavingAudiusModal({ link: url })
}
},
[linkTo, openLink, openLeavingAudiusModal]
[onPress, linkTo, openLink, openLeavingAudiusModal]
)

const renderLink = useCallback(
Expand Down Expand Up @@ -182,7 +184,7 @@ export const Hyperlink = (props: HyperlinkProps) => {
left: linkLayout.x - linkContainerLayout.x
}
]}
onPress={() => handlePress(match.getAnchorHref())}
onPress={() => handlePress(match.getAnchorHref(), match)}
>
{text}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type InternalProps = {
}

export type TextInputProps = RNTextInputProps & {
id?: string
/**
* Input sizes. NOTE: small inputs will not show the label
* @default default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -322,6 +322,7 @@ export const ChatMessageListItem = memo(function ChatMessageListItem(
]}
>
<Hyperlink
onPress={Keyboard.dismiss}
text={message.message}
styles={{
root: [
Expand Down