react-native-pdf-renderer 2.2.2 → 2.3.0

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/android/gradlew CHANGED
File without changes
@@ -61,20 +61,21 @@ NSNotificationName const RNPDFViewErrorNotification = @"RNPDFViewErrorNotificati
61
61
  self.document = pdfDocument;
62
62
  });
63
63
 
64
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
65
- // In certain scenarios, scaleFactorForSizeToFit may be 0.
66
- // This results in invalid calculations for the CoreGraphics API, affecting the PDF positioning.
67
- // Consequence: PDF displayed in the wrong position and zoom unavailable.
68
- // This is a temporary workaround to handle the production bug until a better approach is implemented.
69
- sleep(1);
70
-
71
- dispatch_async(dispatch_get_main_queue(), ^{
72
- self.minScaleFactor = self.scaleFactorForSizeToFit == 0 ? 1 : self.scaleFactorForSizeToFit;
73
- if (maxZoom > 0) {
74
- self.maxScaleFactor = maxZoom * self.minScaleFactor;
75
- }
76
- [self setNeedsLayout];
77
- });
64
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
65
+ // In certain scenarios, scaleFactorForSizeToFit may be 0.
66
+ // This results in invalid calculations for the CoreGraphics API, affecting the PDF positioning.
67
+ // Consequence: PDF displayed in the wrong position and zoom unavailable.
68
+ // This is a temporary workaround to handle the production bug until a better approach is implemented.
69
+ sleep(1);
70
+
71
+ dispatch_async(dispatch_get_main_queue(), ^{
72
+ self.minScaleFactor = self.scaleFactorForSizeToFit == 0 ? 1 : self.scaleFactorForSizeToFit;
73
+ if (maxZoom > 0) {
74
+ self.maxScaleFactor = maxZoom * self.minScaleFactor;
75
+ }
76
+ [self setNeedsLayout];
77
+ });
78
+ });
78
79
  } else {
79
80
  self.document = nil;
80
81
  }
@@ -58,6 +58,14 @@ BOOL observerAdded = NO;
58
58
  return self;
59
59
  }
60
60
 
61
+ +(BOOL)shouldBeRecycled
62
+ {
63
+ // We are disabling recycling for this native view to prevent it from being cached.
64
+ // This ensures that the PDF is reloaded every time the component is re-mounted
65
+ // or any of its props change, providing a fresh instance for each render.
66
+ return NO;
67
+ }
68
+
61
69
  - (void)dealloc
62
70
  {
63
71
  if (observerAdded) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-pdf-renderer",
3
3
  "displayName": "React-Native Pdf Renderer",
4
- "version": "2.2.2",
4
+ "version": "2.3.0",
5
5
  "description": "⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
6
6
  "main": "dist",
7
7
  "react-native": "src",