Skip to content

Commit c877e85

Browse files
author
PSPDFKit
committed
Release 2.0.4
1 parent ff02b91 commit c877e85

File tree

12 files changed

+2428
-3621
lines changed

12 files changed

+2428
-3621
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
## Newest Release
22

3+
### 2.0.4 - 07 Dec 2021
4+
5+
- Updates the Xcode build settings of the Catalog and Native Catalog example projects to work on iOS simulators on Apple Silicon Macs. (#32129)
6+
- Sets `currentPageIndex` in `onStateChanged` callbacks always to the currently visible page index. Also adds `affectedPageIndex` to get the page that is corresponding to the other states in the callback. (#31926)
7+
- PSPDFKit now requires React Native 0.66.3 or later. (#32119)
8+
- Updates for PSPDFKit 8.0.2 for Android. (#32119)
9+
10+
## Previous Releases
11+
312
### 2.0.3 - 02 Nov 2021
413

514
- PSPDFKit now requires React Native 0.66.1 or later. (#31744)
615
- Updates for PSPDFKit 8.0.1 for Android. (#31744)
716
- Updates for PSPDFKit 11.1 for iOS. (#31654)
817
- Improves the repository's README. (#31633)
918

10-
## Previous Releases
11-
1219
### 2.0.2 - 07 Oct 2021
1320

1421
- Update to PSPDFKit for Android 8.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Contains gradle configuration constants
1616
*/
1717
ext {
18-
PSPDFKIT_VERSION = '8.0.1'
18+
PSPDFKIT_VERSION = '8.0.2'
1919
}
2020

2121
buildscript {

android/src/main/java/com/pspdfkit/react/events/PdfViewStateChangedEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
7575
eventData.putInt("currentPageIndex", currentPageIndex);
7676
eventData.putInt("pageCount", pageCount);
7777
eventData.putBoolean("annotationCreationActive", annotationCreationActive);
78+
eventData.putInt("affectedPageIndex", currentPageIndex);
7879
eventData.putBoolean("annotationEditingActive", annotationEditingActive);
7980
eventData.putBoolean("textSelectionActive", textSelectionActive);
8081
eventData.putBoolean("formEditingActive", formEditingActive);

ios/RCTPSPDFKit/RCTPSPDFKitView.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ - (instancetype)initWithFrame:(CGRect)frame {
3636
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationChangedNotification object:nil];
3737
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationsAddedNotification object:nil];
3838
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationsRemovedNotification object:nil];
39+
40+
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(spreadIndexDidChange:) name:PSPDFDocumentViewControllerSpreadIndexDidChangeNotification object:nil];
3941
}
4042

4143
return self;
@@ -385,7 +387,15 @@ - (void)annotationChangedNotification:(NSNotification *)notification {
385387
}
386388
}
387389

388-
#pragma mark - Customize the Toolbar
390+
- (void)spreadIndexDidChange:(NSNotification *)notification {
391+
PSPDFDocumentViewController *documentViewController = self.pdfController.documentViewController;
392+
if (notification.object != documentViewController) { return; }
393+
PSPDFPageIndex pageIndex = [documentViewController.layout pageRangeForSpreadAtIndex:documentViewController.spreadIndex].location;
394+
PSPDFPageView *pageView = [self.pdfController pageViewForPageAtIndex:pageIndex];
395+
[self onStateChangedForPDFViewController:self.pdfController pageView:pageView pageAtIndex:pageIndex];
396+
}
397+
398+
// MARK: - Customize the Toolbar
389399

390400
- (void)setLeftBarButtonItems:(nullable NSArray <NSString *> *)items forViewMode:(nullable NSString *) viewMode animated:(BOOL)animated {
391401
NSMutableArray *leftItems = [NSMutableArray array];
@@ -459,9 +469,10 @@ - (void)onStateChangedForPDFViewController:(PSPDFViewController *)pdfController
459469
}
460470

461471
self.onStateChanged(@{@"documentLoaded" : @(isDocumentLoaded),
462-
@"currentPageIndex" : @(pageIndex),
472+
@"currentPageIndex" : @(pdfController.pageIndex),
463473
@"pageCount" : @(pageCount),
464474
@"annotationCreationActive" : @(isAnnotationToolBarVisible),
475+
@"affectedPageIndex": @(pageIndex),
465476
@"annotationEditingActive" : @(hasSelectedAnnotations),
466477
@"textSelectionActive" : @(hasSelectedText),
467478
@"formEditingActive" : @(isFormEditingActive)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-pspdfkit",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "React Native PDF Library by PSPDFKit",
55
"keywords": [
66
"react native",
@@ -23,10 +23,10 @@
2323
"peerDependencies": {
2424
"prop-types": "^15.7.2",
2525
"react": "^17.0.2",
26-
"react-native": "^0.66.1"
26+
"react-native": "^0.66.3"
2727
},
2828
"dependencies": {},
2929
"devDependencies": {
30-
"prettier": "^2.4.1"
30+
"prettier": "^2.5.0"
3131
}
3232
}

0 commit comments

Comments
 (0)