-
Notifications
You must be signed in to change notification settings - Fork 637
Description
We are encountering an app crash on Android devices when a user is viewing a PDF using react-native-pdf and closes the page after scrolling through it. The issue is consistently reported in Firebase with an IllegalStateException: Already closed error in the stack trace.
Steps to Reproduce:
Open a PDF with the react-native-pdf component.
Scroll or slide through multiple pages.
Close the PDF viewing page (e.g., by navigating away or closing the screen).
The app crashes.
Stack Trace (Firebase Report):
E FATAL EXCEPTION: PDF renderer
Process: com.app, PID: [varies]
java.lang.IllegalStateException: Already closed
at io.legere.pdfiumandroid.util.ConfigKt.handleAlreadyClosed(Config.kt:20)
at io.legere.pdfiumandroid.PdfPage.close(PdfPage.kt:582)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:56)
at io.legere.pdfiumandroid.PdfiumCore.renderPageBitmap(PdfiumCore.kt:406)
at com.github.barteksc.pdfviewer.PdfFile.renderPageBitmap(PdfFile.java:301)
at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:109)
at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:66)
at android.os.Handler.dispatchMessage(Handler.java:117)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:293)
at android.os.HandlerThread.run(HandlerThread.java:110)
Environment:
Platform: Android
Library: react-native-pdf
react-native-pdf version: 7.0.3
React Native Version: 0.79.2
Affected on multiple Android device models