How to detect a URL and show a preview in chat?

Looking for a way to show link/url previews in React Native. For example if someone links to a YouTube video i would like the small thumbnail and headline to render and be clickable(Linking) like almost every sms or social media platform does. I have come across a package on npm here https://www.npmjs.com/package/react-native-url-preview but i’m not sure that’s the best solution. Given how common of a problem this is i’m guessing that package and its 200 weekly downloads is not the solution most people are using.

Any other ways to achieve this? Seems like running a regex on every message to search for a URL string and then rendering the preview if there is a match with the above package would really bog down the chat app?

Thanks in advance!

bumps