dabakovich / react-native-controlled-mentions

Fully controlled React Native mentions component
MIT License
223 stars 82 forks source link

patternsConfig bug in v3 alpha #89

Open OmkarArora opened 2 years ago

OmkarArora commented 2 years ago

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

TrevPennington commented 1 year ago

I'm getting the same issue

9mzodiac commented 1 year ago

I'm experiencing similar behavior with parseValue

antochan commented 7 months ago

Same here. Any updates on this issue? @dabakovich

antochan commented 7 months ago

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.

see2ever commented 4 weeks ago

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.

could you share your regex?