Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Commit ae7fd96

Browse files
committed
fix: add simple description for regEx
1 parent 021a8da commit ae7fd96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

package/src/components/Message/MessageSimple/utils/renderText.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ export const renderText = <
207207
const match: MatchFunction = (source) => regEx.exec(source);
208208

209209
const mentionsReact: ReactNodeOutput = (node, output, { ...state }) => {
210-
const userName = node.content[0]?.content.replace(/[|&;$%@"<>()+,]/g, '');
210+
/**
211+
* node.content[0]?.replace(/@/g, '');
212+
* removes @ character from userName to properly compare the string
213+
*/
214+
const userName = node.content[0]?.content.replace(/@/g, '');
211215
const onPress = (event: GestureResponderEvent) => {
212216
if (!preventPress && onPressParam) {
213217
onPressParam({

0 commit comments

Comments
 (0)