Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: user-specified custom link pattern handling #54

Merged
merged 3 commits into from
Mar 28, 2021

Conversation

lafiosca
Copy link
Contributor

Hello, thanks for providing this awesome library! We've been using it for a long time now, since v1. We're in the process of adding @-mentions to our app, using react-native-controlled-mentions. We need the ability to render those encoded mentions as links to user profiles to be handled internally by app navigation, but we want to keep the ability to render external links as well. For example:

image

I created a patch to your library to allow users to specify link regex patterns with custom styling and handling to allow us to accomplish this. I thought this might be helpful for a wider variety of uses, as discussed previously in #30 and #25 as well as others, so I am providing this PR. The new logic does however take a slightly different approach, allowing the user to specify styles and press handlers specific to a link type rather than using the top-level override functions. So I will understand if you do not want to incorporate these changes.

@joshswan
Copy link
Owner

Hey @lafiosca, thanks for this awesome PR! At first glance, I'm totally on board with merging this as it's basically exactly how I was thinking of addressing those feature requests but never had the time to actually implement :)

I'll review this weekend - might do some tweaking and I'm tempted to remove latlng in favor of custom matchers. But looks great to me based on a quick look.

@weslleyaraujo
Copy link

@lafiosca this is awesome! I needed exactly that, handle a custom pattern and perform a custom action for it. In my case I need to override the default behaviour for hashtags:

Screen.Recording.2021-03-26.at.20.03.56.mov

I made a custom build from your branch to test it, neat 🤘

@joshswan joshswan merged commit 3f91a09 into joshswan:master Mar 28, 2021
@joshswan
Copy link
Owner

@lafiosca @weslleyaraujo v4.0.0-rc.0 has been published to npm. There were a few changes to prop/option names but all the same functionality should be present. Still a pre-release so additional PRs or feedback welcome :)

@weslleyaraujo
Copy link

Thanks @joshswan ! I am gonna try the RC and report back case I find something 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants