react-native-autolink icon indicating copy to clipboard operation
react-native-autolink copied to clipboard

CustomMatchers should override default matchers

Open Thomas-Bel opened this issue 3 years ago • 5 comments
trafficstars

Hi,

For our app we would like to separately process certain url patterns, while allowing all other urls to be handled normally. I tried to implement this using both url=true and a custom matcher for the special case urls, but this approach fails. The default matching is performed first, and only afterwards the custom matchers are exercised.

Is this desired behaviour?

Thomas-Bel avatar Nov 29 '21 17:11 Thomas-Bel

That's the current expected behavior, though I do agree that it may not be optimal. As I just mentioned in #59, it might be better for you to just disable the default matcher and implement a custom URL matcher that you can control better (for example using the regex I posted there).

Working on solutions to solve both this and #59 in a new version - leaning towards removing Autolinker.js and implementing everything as matchers that can be more easily controlled/customized.

joshswan avatar Nov 29 '21 18:11 joshswan

Thanks for the quick response. For now I do appreciate the option to identify urls without the www or http prefix, so I have gotten it to work with patch-package by switching around the order of the two replacement operations in the Autolink file.

Thomas-Bel avatar Nov 29 '21 21:11 Thomas-Bel