react-native-pdf-jsi 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,7 @@
12
12
  [![Expo Compatible](https://img.shields.io/badge/Expo-Compatible-4630EB?style=flat-square&logo=expo)](https://expo.dev)
13
13
  [![total downloads](https://img.shields.io/npm/dt/react-native-pdf-jsi?style=flat-square&logo=npm&color=cb3837)](https://www.npmjs.com/package/react-native-pdf-jsi)
14
14
  [![weekly downloads](https://img.shields.io/npm/dw/react-native-pdf-jsi?style=flat-square&logo=npm&color=cb3837)](https://www.npmjs.com/package/react-native-pdf-jsi)
15
+ [![monthly downloads](https://img.shields.io/npm/dm/react-native-pdf-jsi?style=flat-square&logo=npm&color=cb3837)](https://www.npmjs.com/package/react-native-pdf-jsi)
15
16
  [![GitHub stars](https://img.shields.io/github/stars/126punith/react-native-pdf-jsi?style=flat-square&logo=github&color=181717)](https://github.com/126punith/react-native-pdf-jsi)
16
17
  [![license](https://img.shields.io/npm/l/react-native-pdf-jsi?style=flat-square&color=green)](https://github.com/126punith/react-native-pdf-jsi/blob/main/LICENSE)
17
18
 
@@ -456,6 +457,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
456
457
 
457
458
  ## Recent Fixes
458
459
 
460
+ ### Android PDF Preserved on Navigation (v4.3.1)
461
+ Fixed issue where the PDF instance was destroyed on Android when navigating away and returning to the screen ([#20](https://github.com/126punith/react-native-pdf-jsi/issues/20)). The PDF is now preserved in memory during navigation (matching iOS behavior) and only recycled when the component unmounts.
462
+
459
463
  ### Expo Support (v4.3.0)
460
464
  Added Expo config plugin for seamless integration with Expo development builds. The package now works with `npx expo prebuild` and `npx expo run:ios/android`.
461
465
 
@@ -60,7 +60,8 @@ public class PdfManager extends SimpleViewManager<PdfView> implements RNPDFPdfVi
60
60
 
61
61
  @Override
62
62
  public void onDropViewInstance(PdfView pdfView) {
63
- pdfView = null;
63
+ pdfView.recycle();
64
+ this.pdfView = null;
64
65
  }
65
66
 
66
67
  @ReactProp(name = "path")
@@ -349,6 +349,18 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
349
349
  this.drawPdf();
350
350
  }
351
351
 
352
+ /**
353
+ * Override to prevent barteksc PDFView's recycle() on navigation.
354
+ * The parent class calls recycle() in onDetachedFromWindow, which destroys the PDF
355
+ * when the view is temporarily detached (e.g., navigating to another screen).
356
+ * We only recycle when PdfManager.onDropViewInstance is called (component unmount).
357
+ */
358
+ @Override
359
+ protected void onDetachedFromWindow() {
360
+ // Intentionally skip super to prevent barteksc PDFView's recycle() which destroys
361
+ // the PDF on navigation. We only recycle when PdfManager.onDropViewInstance is called.
362
+ }
363
+
352
364
  public void drawPdf() {
353
365
 
354
366
  // FIX: Check if we actually need to reload the document
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-pdf-jsi",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "summary": "High-performance React Native PDF viewer with JSI acceleration - up to 80x faster than traditional bridge",
5
5
  "description": "🚀 Ultra-fast React Native PDF viewer with JSI (JavaScript Interface) integration for maximum performance. Features lazy loading, smart caching, progressive loading, and zero-bridge overhead operations. Perfect for large PDF files with 30-day persistent cache and advanced memory optimization. Google Play 16KB page size compliant for Android 15+. Supports iOS, Android, and Windows platforms.",
6
6
  "main": "index.js",