Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HyperLinks on onPressLink is not working in IOS. #841

Open
TajGoud opened this issue May 30, 2024 · 12 comments
Open

HyperLinks on onPressLink is not working in IOS. #841

TajGoud opened this issue May 30, 2024 · 12 comments

Comments

@TajGoud
Copy link

TajGoud commented May 30, 2024

In the PDF package, hyperlinks are functioning correctly on Android, but the onPressLink functionality is not working as expected on iOS.

<Pdf
source={
description.PrivacyPolicy
}
onLoadProgress={() => setLoading(true)}
onLoadComplete={() => setLoading(false)}
trustAllCerts={false}
enableDoubleTapZoom={false}
style={styles.pdfView}
renderActivityIndicator={() => }
onPressLink={uri => Linking.openURL(uri)}
/>

@harrymash2006
Copy link

Any luck on this?

@jasonxbliu
Copy link

Please make sure you have installed the right version of @config-plugins/react-native-blob-util,@config-plugins/react-native-pdf, react native pdf and RN.

image image

@TajGoud
Copy link
Author

TajGoud commented Jun 21, 2024

@jasonxbliu we are using the cli.

"react-native": "0.73.6",
"react-native-pdf": "^6.7.5",
"react-native-blob-util": "^0.19.9",

@jasonxbliu
Copy link

@jasonxbliu we are using the cli.

"react-native": "0.73.6",
"react-native-pdf": "^6.7.5",
"react-native-blob-util": "^0.19.9",

What is the version of expo and plugin? As the screenshot I posted, as you use the version of 6.7.5, the right version of expo is expo51. I have encountered the same issue and fixed it until I made all the related version compatible. You can check it again. @TajGoud

@SruthiVj
Copy link

I'm using the correct versions. But still facing the issue

@TajGoud
Copy link
Author

TajGoud commented Jul 15, 2024

@jasonxbliu we are using the cli.

"react-native": "0.73.6",
"react-native-pdf": "^6.7.5",
"react-native-blob-util": "^0.19.9",

What is the version of expo and plugin? As the screenshot I posted, as you use the version of 6.7.5, the right version of expo is expo51. I have encountered the same issue and fixed it until I made all the related version compatible. You can check it again. @TajGoud

Am not using expo using cli version is 12.3.2 @jasonxbliu

@andywall66
Copy link

andywall66 commented Aug 5, 2024

Same issue here. It seems to be an issue at the native level. The iOS implementation of this relies on the PDFViewWillClickOnLink of the delegate - whatever that means (I am not very familiar with underlying native patterns) - and it does not get triggered when I tap on a link. So far, I've put logs in a couple of places in the native code in RNPDFPdfView.mm, and am seeing:

  • Logging at notifyOnChangeWithMessage - which sends all messages to the JS side - is working
  • Logging at handleSingleTap - is working, firing every time I single-tap, whether over a link or not
  • Logging at PDFViewWillClickOnLink - is not working.

This is with:
iOS 17.5.1
react-native 0.74.2
react-native-pdf 6.7.5
react-native-blob-util 0.19.9

And to be clear - I am not using Expo at all.

@apulk97
Copy link

apulk97 commented Aug 14, 2024

Any luck in this?

@haozxyz
Copy link

haozxyz commented Aug 15, 2024

The problem actually already pointing out in that PR issue
To totally remove this part

    // Disable built-in double tap, so as not to conflict with custom recognizers.
    for (UIGestureRecognizer *recognizer in _pdfView.gestureRecognizers) {
        if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]) {
            recognizer.enabled = NO;
        }
    }

or set recognizer.enabled = YES will fix the issue

@adityacarnera
Copy link

@haozxyz Works, thanks

@andywall66
Copy link

andywall66 commented Aug 16, 2024

Yep - that did it - thanks @haozxyz !

@Moggieggwp
Copy link

#841 (comment)

so it should be a patch with a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants