Skip to content

Commit 1a429f4

Browse files
committed
fix: link press on Android doesn't work
Linking.canOpenURL() has proven unreliable. This patch avoids its usage as a workaround. See facebook/react-native#32960 fix #546
1 parent 073d4db commit 1a429f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/render-html/src/context/defaultRendererProps.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { Linking } from 'react-native';
22
import { RenderersProps } from '../shared-types';
33

44
export async function defaultAOnPress(_e: any, href: string): Promise<unknown> {
5-
if (await Linking.canOpenURL(href)) {
6-
return Linking.openURL(href);
5+
try {
6+
await Linking.openURL(href);
7+
} catch (e) {
8+
console.warn(`Could not open URL "${href}".`, e);
79
}
10+
return null;
811
}
912

1013
const defaultRendererProps: Required<RenderersProps> = {

0 commit comments

Comments
 (0)