react-native-pdf-jsi 4.2.0 → 4.2.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 +2 -0
- package/ios/RNPDFPdf/RNPDFPdfView.mm +0 -309
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -409,6 +409,8 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
409
409
|
- **Author**: Punith M ([@126punith](https://github.com/126punith))
|
|
410
410
|
|
|
411
411
|
## Recent Fixes
|
|
412
|
+
### iOS Performance - Unnecessary Path Handlers (v4.2.1)
|
|
413
|
+
Use v4.2.1 it contains stable fixes for IOS with unwanted debug logs removed
|
|
412
414
|
|
|
413
415
|
### iOS Performance - Unnecessary Path Handlers (v4.2.0)
|
|
414
416
|
Fixed performance issue where path-related handlers were running unnecessarily when the path value hadn't actually changed. The fix filters out "path" from effectiveChangedProps when pathActuallyChanged=NO, preventing unnecessary reconfigurations of spacing, display direction, scroll views, usePageViewController, and other path-dependent handlers. This reduces unnecessary rerenders and improves performance, especially when navigating between pages. Addresses issue #7 (Page Prop Causes Full Rerender).
|
|
@@ -399,29 +399,6 @@ using namespace facebook::react;
|
|
|
399
399
|
_currentUsePageViewController = NO;
|
|
400
400
|
_usePageViewControllerStateInitialized = NO;
|
|
401
401
|
|
|
402
|
-
// #region agent log
|
|
403
|
-
{
|
|
404
|
-
NSString *logPath0 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
405
|
-
NSDictionary *logEntry0 = @{
|
|
406
|
-
@"sessionId": @"debug-session",
|
|
407
|
-
@"runId": @"init",
|
|
408
|
-
@"hypothesisId": @"F",
|
|
409
|
-
@"location": @"RNPDFPdfView.mm:393",
|
|
410
|
-
@"message": @"initCommonProps completed",
|
|
411
|
-
@"data": @{
|
|
412
|
-
@"horizontal": @(_horizontal),
|
|
413
|
-
@"enablePaging": @(_enablePaging),
|
|
414
|
-
@"scrollEnabled": @(_scrollEnabled),
|
|
415
|
-
@"singlePage": @(_singlePage)
|
|
416
|
-
},
|
|
417
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
418
|
-
};
|
|
419
|
-
NSData *logData0 = [NSJSONSerialization dataWithJSONObject:logEntry0 options:0 error:nil];
|
|
420
|
-
NSString *logLine0 = [[NSString alloc] initWithData:logData0 encoding:NSUTF8StringEncoding];
|
|
421
|
-
[[logLine0 stringByAppendingString:@"\n"] writeToFile:logPath0 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
422
|
-
}
|
|
423
|
-
// #endregion
|
|
424
|
-
|
|
425
402
|
// Enhanced properties
|
|
426
403
|
_enableCaching = YES;
|
|
427
404
|
_enablePreloading = YES;
|
|
@@ -802,38 +779,6 @@ using namespace facebook::react;
|
|
|
802
779
|
_page > 0 &&
|
|
803
780
|
_page <= (int)_pdfDocument.pageCount;
|
|
804
781
|
|
|
805
|
-
// #region agent log
|
|
806
|
-
if ([changedProps containsObject:@"page"]) {
|
|
807
|
-
NSString *logPath14 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
808
|
-
NSDictionary *logEntry14 = @{
|
|
809
|
-
@"sessionId": @"debug-session",
|
|
810
|
-
@"runId": @"init",
|
|
811
|
-
@"hypothesisId": @"A,C,D",
|
|
812
|
-
@"location": @"RNPDFPdfView.mm:803",
|
|
813
|
-
@"message": @"updateProps: page prop changed - checking shouldNavigateToPage",
|
|
814
|
-
@"data": @{
|
|
815
|
-
@"_page": @(_page),
|
|
816
|
-
@"_previousPage": @(_previousPage),
|
|
817
|
-
@"documentLoaded": @(_documentLoaded),
|
|
818
|
-
@"isNavigating": @(_isNavigating),
|
|
819
|
-
@"shouldNavigateToPage": @(shouldNavigateToPage),
|
|
820
|
-
@"contentOffsetBeforeNav": _internalScrollView ? @{@"x": @(_internalScrollView.contentOffset.x), @"y": @(_internalScrollView.contentOffset.y)} : @"noScrollView"
|
|
821
|
-
},
|
|
822
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
823
|
-
};
|
|
824
|
-
NSData *logData14 = [NSJSONSerialization dataWithJSONObject:logEntry14 options:0 error:nil];
|
|
825
|
-
NSString *logLine14 = [[NSString alloc] initWithData:logData14 encoding:NSUTF8StringEncoding];
|
|
826
|
-
NSFileHandle *fileHandle14 = [NSFileHandle fileHandleForWritingAtPath:logPath14];
|
|
827
|
-
if (fileHandle14) {
|
|
828
|
-
[fileHandle14 seekToEndOfFile];
|
|
829
|
-
[fileHandle14 writeData:[[logLine14 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
830
|
-
[fileHandle14 closeFile];
|
|
831
|
-
} else {
|
|
832
|
-
[[logLine14 stringByAppendingString:@"\n"] writeToFile:logPath14 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
// #endregion
|
|
836
|
-
|
|
837
782
|
if (shouldNavigateToPage) {
|
|
838
783
|
_isNavigating = YES;
|
|
839
784
|
PDFPage *pdfPage = [_pdfDocument pageAtIndex:_page-1];
|
|
@@ -841,35 +786,6 @@ using namespace facebook::react;
|
|
|
841
786
|
if (pdfPage) {
|
|
842
787
|
// Use smooth navigation instead of instant jump to prevent full rerender
|
|
843
788
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
844
|
-
// #region agent log
|
|
845
|
-
CGPoint contentOffsetBefore = self->_internalScrollView ? self->_internalScrollView.contentOffset : CGPointMake(0, 0);
|
|
846
|
-
NSString *logPath15 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
847
|
-
NSDictionary *logEntry15 = @{
|
|
848
|
-
@"sessionId": @"debug-session",
|
|
849
|
-
@"runId": @"init",
|
|
850
|
-
@"hypothesisId": @"B,C",
|
|
851
|
-
@"location": @"RNPDFPdfView.mm:812",
|
|
852
|
-
@"message": @"goToDestination: BEFORE navigation call",
|
|
853
|
-
@"data": @{
|
|
854
|
-
@"targetPage": @(self->_page),
|
|
855
|
-
@"enablePaging": @(self->_enablePaging),
|
|
856
|
-
@"contentOffsetBefore": @{@"x": @(contentOffsetBefore.x), @"y": @(contentOffsetBefore.y)},
|
|
857
|
-
@"isNavigating": @(self->_isNavigating)
|
|
858
|
-
},
|
|
859
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
860
|
-
};
|
|
861
|
-
NSData *logData15 = [NSJSONSerialization dataWithJSONObject:logEntry15 options:0 error:nil];
|
|
862
|
-
NSString *logLine15 = [[NSString alloc] initWithData:logData15 encoding:NSUTF8StringEncoding];
|
|
863
|
-
NSFileHandle *fileHandle15 = [NSFileHandle fileHandleForWritingAtPath:logPath15];
|
|
864
|
-
if (fileHandle15) {
|
|
865
|
-
[fileHandle15 seekToEndOfFile];
|
|
866
|
-
[fileHandle15 writeData:[[logLine15 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
867
|
-
[fileHandle15 closeFile];
|
|
868
|
-
} else {
|
|
869
|
-
[[logLine15 stringByAppendingString:@"\n"] writeToFile:logPath15 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
870
|
-
}
|
|
871
|
-
// #endregion
|
|
872
|
-
|
|
873
789
|
if (!self->_enablePaging) {
|
|
874
790
|
// For non-paging mode, use animated navigation
|
|
875
791
|
CGRect pdfPageRect = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
|
|
@@ -904,38 +820,6 @@ using namespace facebook::react;
|
|
|
904
820
|
|
|
905
821
|
self->_previousPage = self->_page;
|
|
906
822
|
self->_isNavigating = NO;
|
|
907
|
-
|
|
908
|
-
// #region agent log
|
|
909
|
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
910
|
-
CGPoint contentOffsetAfter = self->_internalScrollView ? self->_internalScrollView.contentOffset : CGPointMake(0, 0);
|
|
911
|
-
NSString *logPath16 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
912
|
-
NSDictionary *logEntry16 = @{
|
|
913
|
-
@"sessionId": @"debug-session",
|
|
914
|
-
@"runId": @"init",
|
|
915
|
-
@"hypothesisId": @"B,C",
|
|
916
|
-
@"location": @"RNPDFPdfView.mm:845",
|
|
917
|
-
@"message": @"goToDestination: AFTER navigation call (100ms delay)",
|
|
918
|
-
@"data": @{
|
|
919
|
-
@"targetPage": @(self->_page),
|
|
920
|
-
@"previousPage": @(self->_previousPage),
|
|
921
|
-
@"contentOffsetBefore": @{@"x": @(contentOffsetBefore.x), @"y": @(contentOffsetBefore.y)},
|
|
922
|
-
@"contentOffsetAfter": @{@"x": @(contentOffsetAfter.x), @"y": @(contentOffsetAfter.y)},
|
|
923
|
-
@"offsetChanged": @(fabs(contentOffsetBefore.x - contentOffsetAfter.x) > 1 || fabs(contentOffsetBefore.y - contentOffsetAfter.y) > 1)
|
|
924
|
-
},
|
|
925
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
926
|
-
};
|
|
927
|
-
NSData *logData16 = [NSJSONSerialization dataWithJSONObject:logEntry16 options:0 error:nil];
|
|
928
|
-
NSString *logLine16 = [[NSString alloc] initWithData:logData16 encoding:NSUTF8StringEncoding];
|
|
929
|
-
NSFileHandle *fileHandle16 = [NSFileHandle fileHandleForWritingAtPath:logPath16];
|
|
930
|
-
if (fileHandle16) {
|
|
931
|
-
[fileHandle16 seekToEndOfFile];
|
|
932
|
-
[fileHandle16 writeData:[[logLine16 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
933
|
-
[fileHandle16 closeFile];
|
|
934
|
-
} else {
|
|
935
|
-
[[logLine16 stringByAppendingString:@"\n"] writeToFile:logPath16 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
936
|
-
}
|
|
937
|
-
});
|
|
938
|
-
// #endregion
|
|
939
823
|
});
|
|
940
824
|
} else {
|
|
941
825
|
_isNavigating = NO;
|
|
@@ -1415,40 +1299,6 @@ using namespace facebook::react;
|
|
|
1415
1299
|
NSStringFromCGSize(scrollView.contentSize),
|
|
1416
1300
|
enabled);
|
|
1417
1301
|
|
|
1418
|
-
// #region agent log
|
|
1419
|
-
{
|
|
1420
|
-
NSString *logPath1 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1421
|
-
NSDictionary *logEntry1 = @{
|
|
1422
|
-
@"sessionId": @"debug-session",
|
|
1423
|
-
@"runId": @"init",
|
|
1424
|
-
@"hypothesisId": @"D,F",
|
|
1425
|
-
@"location": @"RNPDFPdfView.mm:1307",
|
|
1426
|
-
@"message": @"Found UIScrollView in hierarchy",
|
|
1427
|
-
@"data": @{
|
|
1428
|
-
@"depth": @(depth),
|
|
1429
|
-
@"contentSize": @{@"width": @(scrollView.contentSize.width), @"height": @(scrollView.contentSize.height)},
|
|
1430
|
-
@"frame": @{@"x": @(scrollView.frame.origin.x), @"y": @(scrollView.frame.origin.y), @"width": @(scrollView.frame.size.width), @"height": @(scrollView.frame.size.height)},
|
|
1431
|
-
@"scrollEnabled": @(scrollView.scrollEnabled),
|
|
1432
|
-
@"alwaysBounceHorizontal": @(scrollView.alwaysBounceHorizontal),
|
|
1433
|
-
@"userInteractionEnabled": @(scrollView.userInteractionEnabled),
|
|
1434
|
-
@"horizontal": @(_horizontal),
|
|
1435
|
-
@"enablePaging": @(_enablePaging)
|
|
1436
|
-
},
|
|
1437
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1438
|
-
};
|
|
1439
|
-
NSData *logData1 = [NSJSONSerialization dataWithJSONObject:logEntry1 options:0 error:nil];
|
|
1440
|
-
NSString *logLine1 = [[NSString alloc] initWithData:logData1 encoding:NSUTF8StringEncoding];
|
|
1441
|
-
NSFileHandle *fileHandle1 = [NSFileHandle fileHandleForWritingAtPath:logPath1];
|
|
1442
|
-
if (fileHandle1) {
|
|
1443
|
-
[fileHandle1 seekToEndOfFile];
|
|
1444
|
-
[fileHandle1 writeData:[[logLine1 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1445
|
-
[fileHandle1 closeFile];
|
|
1446
|
-
} else {
|
|
1447
|
-
[[logLine1 stringByAppendingString:@"\n"] writeToFile:logPath1 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
// #endregion
|
|
1451
|
-
|
|
1452
1302
|
// Since we're starting the recursion from _pdfView, all scroll views found are within its hierarchy
|
|
1453
1303
|
// Configure scroll properties
|
|
1454
1304
|
BOOL previousScrollEnabled = scrollView.scrollEnabled;
|
|
@@ -1484,40 +1334,6 @@ using namespace facebook::react;
|
|
|
1484
1334
|
scrollView.bounces,
|
|
1485
1335
|
scrollView.delegate != nil ? @"set" : @"nil");
|
|
1486
1336
|
|
|
1487
|
-
// #region agent log
|
|
1488
|
-
{
|
|
1489
|
-
NSString *logPath3 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1490
|
-
NSDictionary *logEntry3 = @{
|
|
1491
|
-
@"sessionId": @"debug-session",
|
|
1492
|
-
@"runId": @"init",
|
|
1493
|
-
@"hypothesisId": @"A,B,C,D,E",
|
|
1494
|
-
@"location": @"RNPDFPdfView.mm:1374",
|
|
1495
|
-
@"message": @"ScrollView configuration completed",
|
|
1496
|
-
@"data": @{
|
|
1497
|
-
@"scrollEnabled": @(scrollView.scrollEnabled),
|
|
1498
|
-
@"alwaysBounceHorizontal": @(scrollView.alwaysBounceHorizontal),
|
|
1499
|
-
@"bounces": @(scrollView.bounces),
|
|
1500
|
-
@"contentSize": @{@"width": @(scrollView.contentSize.width), @"height": @(scrollView.contentSize.height)},
|
|
1501
|
-
@"userInteractionEnabled": @(scrollView.userInteractionEnabled),
|
|
1502
|
-
@"delegate": scrollView.delegate != nil ? @"set" : @"nil",
|
|
1503
|
-
@"horizontal": @(_horizontal),
|
|
1504
|
-
@"enablePaging": @(_enablePaging)
|
|
1505
|
-
},
|
|
1506
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1507
|
-
};
|
|
1508
|
-
NSData *logData3 = [NSJSONSerialization dataWithJSONObject:logEntry3 options:0 error:nil];
|
|
1509
|
-
NSString *logLine3 = [[NSString alloc] initWithData:logData3 encoding:NSUTF8StringEncoding];
|
|
1510
|
-
NSFileHandle *fileHandle3 = [NSFileHandle fileHandleForWritingAtPath:logPath3];
|
|
1511
|
-
if (fileHandle3) {
|
|
1512
|
-
[fileHandle3 seekToEndOfFile];
|
|
1513
|
-
[fileHandle3 writeData:[[logLine3 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1514
|
-
[fileHandle3 closeFile];
|
|
1515
|
-
} else {
|
|
1516
|
-
[[logLine3 stringByAppendingString:@"\n"] writeToFile:logPath3 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
// #endregion
|
|
1520
|
-
|
|
1521
1337
|
// IMPORTANT: PDFKit relies on the scrollView delegate for pinch-zoom (viewForZoomingInScrollView).
|
|
1522
1338
|
// Install a proxy delegate that forwards to the original delegate, while still letting us observe scroll events.
|
|
1523
1339
|
if (!_internalScrollView) {
|
|
@@ -1549,41 +1365,6 @@ using namespace facebook::react;
|
|
|
1549
1365
|
RCTLogWarn(@"⚠️ [iOS Scroll] No UIScrollView found in view hierarchy (view=%@, subviewCount=%lu)",
|
|
1550
1366
|
NSStringFromClass([view class]),
|
|
1551
1367
|
(unsigned long)[view.subviews count]);
|
|
1552
|
-
|
|
1553
|
-
// #region agent log
|
|
1554
|
-
{
|
|
1555
|
-
NSString *logPath6 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1556
|
-
NSMutableArray *subviewClasses = [NSMutableArray array];
|
|
1557
|
-
for (UIView *subview in view.subviews) {
|
|
1558
|
-
[subviewClasses addObject:NSStringFromClass([subview class])];
|
|
1559
|
-
}
|
|
1560
|
-
NSDictionary *logEntry6 = @{
|
|
1561
|
-
@"sessionId": @"debug-session",
|
|
1562
|
-
@"runId": @"init",
|
|
1563
|
-
@"hypothesisId": @"F",
|
|
1564
|
-
@"location": @"RNPDFPdfView.mm:1446",
|
|
1565
|
-
@"message": @"No UIScrollView found in hierarchy",
|
|
1566
|
-
@"data": @{
|
|
1567
|
-
@"viewClass": NSStringFromClass([view class]),
|
|
1568
|
-
@"subviewCount": @([view.subviews count]),
|
|
1569
|
-
@"subviewClasses": subviewClasses,
|
|
1570
|
-
@"horizontal": @(_horizontal),
|
|
1571
|
-
@"enablePaging": @(_enablePaging)
|
|
1572
|
-
},
|
|
1573
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1574
|
-
};
|
|
1575
|
-
NSData *logData6 = [NSJSONSerialization dataWithJSONObject:logEntry6 options:0 error:nil];
|
|
1576
|
-
NSString *logLine6 = [[NSString alloc] initWithData:logData6 encoding:NSUTF8StringEncoding];
|
|
1577
|
-
NSFileHandle *fileHandle6 = [NSFileHandle fileHandleForWritingAtPath:logPath6];
|
|
1578
|
-
if (fileHandle6) {
|
|
1579
|
-
[fileHandle6 seekToEndOfFile];
|
|
1580
|
-
[fileHandle6 writeData:[[logLine6 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1581
|
-
[fileHandle6 closeFile];
|
|
1582
|
-
} else {
|
|
1583
|
-
[[logLine6 stringByAppendingString:@"\n"] writeToFile:logPath6 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
// #endregion
|
|
1587
1368
|
}
|
|
1588
1369
|
}
|
|
1589
1370
|
|
|
@@ -1604,38 +1385,6 @@ using namespace facebook::react;
|
|
|
1604
1385
|
scrollView.bounds.size.width,
|
|
1605
1386
|
scrollView.bounds.size.height,
|
|
1606
1387
|
scrollView.scrollEnabled);
|
|
1607
|
-
|
|
1608
|
-
// #region agent log
|
|
1609
|
-
{
|
|
1610
|
-
NSString *logPath2 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1611
|
-
NSDictionary *logEntry2 = @{
|
|
1612
|
-
@"sessionId": @"debug-session",
|
|
1613
|
-
@"runId": @"init",
|
|
1614
|
-
@"hypothesisId": @"B",
|
|
1615
|
-
@"location": @"RNPDFPdfView.mm:1300",
|
|
1616
|
-
@"message": @"scrollViewDidScroll called",
|
|
1617
|
-
@"data": @{
|
|
1618
|
-
@"eventCount": @(scrollEventCount),
|
|
1619
|
-
@"contentOffset": @{@"x": @(scrollView.contentOffset.x), @"y": @(scrollView.contentOffset.y)},
|
|
1620
|
-
@"contentSize": @{@"width": @(scrollView.contentSize.width), @"height": @(scrollView.contentSize.height)},
|
|
1621
|
-
@"bounds": @{@"width": @(scrollView.bounds.size.width), @"height": @(scrollView.bounds.size.height)},
|
|
1622
|
-
@"scrollEnabled": @(scrollView.scrollEnabled),
|
|
1623
|
-
@"alwaysBounceHorizontal": @(scrollView.alwaysBounceHorizontal)
|
|
1624
|
-
},
|
|
1625
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1626
|
-
};
|
|
1627
|
-
NSData *logData2 = [NSJSONSerialization dataWithJSONObject:logEntry2 options:0 error:nil];
|
|
1628
|
-
NSString *logLine2 = [[NSString alloc] initWithData:logData2 encoding:NSUTF8StringEncoding];
|
|
1629
|
-
NSFileHandle *fileHandle2 = [NSFileHandle fileHandleForWritingAtPath:logPath2];
|
|
1630
|
-
if (fileHandle2) {
|
|
1631
|
-
[fileHandle2 seekToEndOfFile];
|
|
1632
|
-
[fileHandle2 writeData:[[logLine2 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1633
|
-
[fileHandle2 closeFile];
|
|
1634
|
-
} else {
|
|
1635
|
-
[[logLine2 stringByAppendingString:@"\n"] writeToFile:logPath2 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
// #endregion
|
|
1639
1388
|
}
|
|
1640
1389
|
|
|
1641
1390
|
if (!_pdfDocument || _singlePage) {
|
|
@@ -1664,36 +1413,6 @@ using namespace facebook::react;
|
|
|
1664
1413
|
// Only update if page actually changed and is valid
|
|
1665
1414
|
if (newPage != _page && newPage > 0 && newPage <= (int)_pdfDocument.pageCount) {
|
|
1666
1415
|
RCTLogInfo(@"📄 [iOS Scroll] Page changed: %d -> %d (from scroll position)", _page, newPage);
|
|
1667
|
-
// #region agent log
|
|
1668
|
-
{
|
|
1669
|
-
NSString *logPath12 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1670
|
-
NSDictionary *logEntry12 = @{
|
|
1671
|
-
@"sessionId": @"debug-session",
|
|
1672
|
-
@"runId": @"init",
|
|
1673
|
-
@"hypothesisId": @"A,C,D",
|
|
1674
|
-
@"location": @"RNPDFPdfView.mm:1558",
|
|
1675
|
-
@"message": @"scrollViewDidScroll detected page change - BEFORE updating _page",
|
|
1676
|
-
@"data": @{
|
|
1677
|
-
@"oldPage": @(_page),
|
|
1678
|
-
@"newPage": @(newPage),
|
|
1679
|
-
@"previousPage": @(_previousPage),
|
|
1680
|
-
@"contentOffset": @{@"x": @(scrollView.contentOffset.x), @"y": @(scrollView.contentOffset.y)},
|
|
1681
|
-
@"isNavigating": @(_isNavigating)
|
|
1682
|
-
},
|
|
1683
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1684
|
-
};
|
|
1685
|
-
NSData *logData12 = [NSJSONSerialization dataWithJSONObject:logEntry12 options:0 error:nil];
|
|
1686
|
-
NSString *logLine12 = [[NSString alloc] initWithData:logData12 encoding:NSUTF8StringEncoding];
|
|
1687
|
-
NSFileHandle *fileHandle12 = [NSFileHandle fileHandleForWritingAtPath:logPath12];
|
|
1688
|
-
if (fileHandle12) {
|
|
1689
|
-
[fileHandle12 seekToEndOfFile];
|
|
1690
|
-
[fileHandle12 writeData:[[logLine12 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1691
|
-
[fileHandle12 closeFile];
|
|
1692
|
-
} else {
|
|
1693
|
-
[[logLine12 stringByAppendingString:@"\n"] writeToFile:logPath12 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
// #endregion
|
|
1697
1416
|
|
|
1698
1417
|
// CRITICAL FIX: Update _previousPage to the new page value when page changes from user scrolling
|
|
1699
1418
|
// This prevents updateProps from triggering programmatic navigation when React Native
|
|
@@ -1712,34 +1431,6 @@ using namespace facebook::react;
|
|
|
1712
1431
|
|
|
1713
1432
|
// Notify about page change
|
|
1714
1433
|
[self notifyOnChangeWithMessage:[[NSString alloc] initWithString:[NSString stringWithFormat:@"pageChanged|%d|%lu", newPage, _pdfDocument.pageCount]]];
|
|
1715
|
-
// #region agent log
|
|
1716
|
-
{
|
|
1717
|
-
NSString *logPath13 = @"/Users/punithmanthri/Documents/github jsi folder /react-native-enhanced-pdf/.cursor/debug.log";
|
|
1718
|
-
NSDictionary *logEntry13 = @{
|
|
1719
|
-
@"sessionId": @"debug-session",
|
|
1720
|
-
@"runId": @"init",
|
|
1721
|
-
@"hypothesisId": @"A,C,D",
|
|
1722
|
-
@"location": @"RNPDFPdfView.mm:1570",
|
|
1723
|
-
@"message": @"scrollViewDidScroll detected page change - AFTER updating _page and _previousPage (to prevent navigation loop)",
|
|
1724
|
-
@"data": @{
|
|
1725
|
-
@"_page": @(_page),
|
|
1726
|
-
@"_previousPage": @(_previousPage),
|
|
1727
|
-
@"notificationSent": @YES
|
|
1728
|
-
},
|
|
1729
|
-
@"timestamp": @((long long)([[NSDate date] timeIntervalSince1970] * 1000))
|
|
1730
|
-
};
|
|
1731
|
-
NSData *logData13 = [NSJSONSerialization dataWithJSONObject:logEntry13 options:0 error:nil];
|
|
1732
|
-
NSString *logLine13 = [[NSString alloc] initWithData:logData13 encoding:NSUTF8StringEncoding];
|
|
1733
|
-
NSFileHandle *fileHandle13 = [NSFileHandle fileHandleForWritingAtPath:logPath13];
|
|
1734
|
-
if (fileHandle13) {
|
|
1735
|
-
[fileHandle13 seekToEndOfFile];
|
|
1736
|
-
[fileHandle13 writeData:[[logLine13 stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
1737
|
-
[fileHandle13 closeFile];
|
|
1738
|
-
} else {
|
|
1739
|
-
[[logLine13 stringByAppendingString:@"\n"] writeToFile:logPath13 atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
// #endregion
|
|
1743
1434
|
}
|
|
1744
1435
|
} else {
|
|
1745
1436
|
if (scrollEventCount % 50 == 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pdf-jsi",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.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",
|