react-native-pdf: [Android] Bug: App Crashes on - java.lang.IllegalStateException: Already closed

What react-native version are you using? 0.74.5

What react-native-pdf version are you using? 6.7.5

What platform does your issue occur on? (android/ios/both) android

Describe your issue as precisely as possible :

  1. Steps to reproduce the issue or to explain in which case you get the issue
  2. Interesting logs

Join a screenshot or video of the problem on the simulator or device? image

Show us the code you are using?

<Modal
  animationType="fade"
      transparent={false}
      visible
      onRequestClose={onSyllubusViewRequestClose}
      style={syllabusViewStyle.container}>
      {syllabusLink && (
        <Pdf
          trustAllCerts={false}
          source={{
            uri: syllabusLink,
            cache: true,
            cacheFileName: syllabusLink.split("/")[syllabusLink.split("/").length - 1],
          }}
          onLoadComplete={onLoadComplete}
          onError={onPDFError}
          style={{
            flex: 1,
            marginTop: 50,
            width: Dimensions.get("window").width,
            height: Dimensions.get("window").height - 50,
          }}
        />
      )}
</Modal>

Iam using ExpoSDK 51 this happens when immediately closing the pdf before its loaded while testing,

Is there any solution for this, i though this gets fixed in last version!

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 8
  • Comments: 19

Most upvoted comments

Same issue.

“@config-plugins/react-native-pdf”: “9.0.0”, “react-native-pdf”: “^6.7.7”, “react-native”: “0.77.0”,

@suresh-mojro I am also using URL and cache disabled, in my case react-native version is "0.77.2" .

from react-native-pdf version 6.7.4 onwards they have changed android native dependency for pdf rendering, so i think that was causing the issue, so i have made the changes and created patch for my usability in the latest version it self, this patch will work for both IOS and Android.

react-native-pdf+6.7.7.patch

Issue still persists for version 6.7.6

any news? same issue here