Skip to content

Commit

Permalink
fix: link press on Android doesn't work
Browse files Browse the repository at this point in the history
Linking.canOpenURL() has proven unreliable. This patch avoids its usage
as a workaround. See
facebook/react-native#32960

fix #546
  • Loading branch information
jsamr committed Jan 24, 2022
1 parent 073d4db commit 1a429f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/render-html/src/context/defaultRendererProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { Linking } from 'react-native';
import { RenderersProps } from '../shared-types';

export async function defaultAOnPress(_e: any, href: string): Promise<unknown> {
if (await Linking.canOpenURL(href)) {
return Linking.openURL(href);
try {
await Linking.openURL(href);
} catch (e) {
console.warn(`Could not open URL "${href}".`, e);
}
return null;
}

const defaultRendererProps: Required<RenderersProps> = {
Expand Down

0 comments on commit 1a429f4

Please sign in to comment.