react-native-pdf
react-native-pdf copied to clipboard
Property onPressLink doesn't work in older android versions
Hi There,
I've used an implementation of react-native-pdf V6.2.0 with property onPressLink to redirect the user to native browser through link clicked like bellow:
handleOpenExternalLink = (source) => {
Linking.canOpenURL(source).then((supported) => {
if (supported) {
Linking.openURL(source);
} else {
Alert.alert(
I18n.t('screens.content.components.alert.pdf.messages.error.title'),
I18n.t('screens.content.components.alert.pdf.messages.error.message'),
);
}
});
};
return(
<PdfViewer
source={this.props.isFile ? uri : { uri }}
onPressLink={(source) => this.handleOpenExternalLink(source)}
onError={() => {
Alert.alert(ValidationErrors.alertErrorTitle, ContentText.openFileError, [
{
text: 'OK',
onPress: onBack,
},
]);
}}
/>)
but i noticed it didn't work in older Android version .
Tests:
Galaxy S7 - Android 6 - didn't work Galaxy S8 Plus - Android 9 - worked Galaxy A30 - Android 10 - worked Xiaomi RedmiNote9pró - Android 10 - worked
have someone else passed by same issue?
thank you!
onPressLink Galaxy s20 - Android 11 - not working. Any updates?
@wonday
@IgorX1725 did you manage to fix it?