Skip to content

onPressLink not working in android #983

@Sushmitha-BS25

Description

@Sushmitha-BS25

Issue:
onPressLink is not triggered on Android, while it works as expected on iOS.


Package Version

  • react-native-pdf: v7.0.1 and v7.0.2

Environment

  • React Native: 0.79.5
  • Android OS: Android 13 and 15
  • Device/Emulator: Vivo Y72, Pixel 3a API 35
  • Build Type: Debug And Release
  • Project Type: Bare React Native

Description

When a PDF contains hyperlinks, tapping a link correctly triggers onPressLink on iOS.
However, on Android, tapping the same link does nothing — the callback never fires, and no error is logged.


Expected Behaviour

onPressLink should be triggered on both iOS and Android when a user taps a link in the PDF.


Actual Behaviour

The onPressLink event only fires on iOS.
On Android, tapping a link has no effect and produces no console logs.


Reproducible Example

import React from 'react';
import { View } from 'react-native';
import Pdf from 'react-native-pdf';

export default function PdfLinkTest() {
  return (
    <View style={{ flex: 1 }}>
      <Pdf
        key="pdf"
        trustAllCerts={false}
        onError={error => {console.log(error)}}
        source={{ uri: pdfSource }}
        onPressLink={(url) => console.log(`Link pressed: ${url}`)}
        style={{ flex: 1 }}
      />
    </View>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions