From 9098ed48f2ad56ba21ff5f7a4759124db2fdf25c Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Mon, 20 Nov 2023 11:36:35 +0530 Subject: [PATCH] fix: inability to handle long URLs with params properly when clicked on message --- .../Message/MessageSimple/utils/renderText.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package/src/components/Message/MessageSimple/utils/renderText.tsx b/package/src/components/Message/MessageSimple/utils/renderText.tsx index 4722e6389c..cb84e37ba6 100644 --- a/package/src/components/Message/MessageSimple/utils/renderText.tsx +++ b/package/src/components/Message/MessageSimple/utils/renderText.tsx @@ -141,8 +141,15 @@ export const renderText = < : Linking.canOpenURL(url).then((canOpenUrl) => canOpenUrl && Linking.openURL(url)); }; + let previousLink: string; const linkReact: ReactNodeOutput = (node, output, { ...state }) => { - const url = node.target; + let url: string; + if (state?.withinLink) { + url = previousLink; + } else { + url = node.target; + previousLink = node.target; + } const onPress = (event: GestureResponderEvent) => { if (!preventPress && onPressParam) { onPressParam({