react-native-controlled-mentions icon indicating copy to clipboard operation
react-native-controlled-mentions copied to clipboard

patternsConfig bug in v3 alpha

Open OmkarArora opened this issue 2 years ago • 5 comments

On a successful match from patternsConfig, the text gets deleted rather than getting the desired highlighting

i have referred the example from here - https://github.com/dabakovich/react-native-controlled-mentions/blob/3.0.0-feat-use-mentions/example/mentions-app.tsx#L90

Whenever I write the letter "a" as given in patternsConfig, it gets deleted.

Here is a Snack of my code - https://snack.expo.dev/@halfcold/react-native-controlled-mentions-v3-alpha-testing

OmkarArora avatar Jun 27 '22 06:06 OmkarArora

I'm getting the same issue

TrevPennington avatar Nov 16 '22 14:11 TrevPennington

I'm experiencing similar behavior with parseValue

9mzodiac avatar Sep 25 '23 11:09 9mzodiac

Same here. Any updates on this issue? @dabakovich

antochan avatar Mar 13 '24 19:03 antochan

After a bit of investigation it seems the root issue is from the parseValue function specifically the part where we call const dividedValueByRegex = value.split(regex);

Previously my regex would get split in a way that doesn't really conform to how the library expects. For example https://google.com might result in dividedValueByRegex being ["google.com"] where as the expected value should be [" ", "https://google.com", " "]. For now I have adjusted my regex to ensure that when being called with .split(regex) the format results in the later.

antochan avatar Mar 13 '24 22:03 antochan