this repo has no description
1import { Href, Link } from 'expo-router';
2import { openBrowserAsync } from 'expo-web-browser';
3import { type ComponentProps } from 'react';
4import { Platform } from 'react-native';
5
6type Props = Omit<ComponentProps<typeof Link>, 'href'> & { href: Href & string };
7
8export function ExternalLink({ href, ...rest }: Props) {
9 return (
10 <Link
11 target="_blank"
12 {...rest}
13 href={href}
14 onPress={async (event) => {
15 if (Platform.OS !== 'web') {
16 // Prevent the default behavior of linking to the default browser on native.
17 event.preventDefault();
18 // Open the link in an in-app browser.
19 await openBrowserAsync(href);
20 }
21 }}
22 />
23 );
24}