Skip to content

Commit 5146a72

Browse files
Merge pull request #56 from marllonfrizzo/fix/sintax-issues
Fix syntax issue for #55
2 parents c81b43c + 92da22d commit 5146a72

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

ios/ReactNativePdfRendererLibrary/RNPDFView.mm

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,21 @@ -(void) setParams:(NSDictionary*) params {
6161
self.document = pdfDocument;
6262
});
6363

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+
});
7879
} else {
7980
self.document = nil;
8081
}

0 commit comments

Comments
 (0)