Skip to content

Commit

Permalink
Fixes onPageChange event on iOS when using with React Native modals
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasjunior committed Sep 13, 2024
1 parent 26c94c8 commit 2f7e215
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ios/ReactNativePdfRendererLibrary/RNPdfRendererModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ - (void)handlePageChange:(NSNotification*) notification {

NSUInteger currentPageNumber = [view.document indexForPage:view.currentPage];

view.onPageChange(@{
@"position": [NSNumber numberWithInteger:currentPageNumber],
@"total": [NSNumber numberWithInteger:view.document.pageCount],
dispatch_async(dispatch_get_main_queue(), ^{
view.onPageChange(@{
@"position": [NSNumber numberWithInteger:currentPageNumber],
@"total": [NSNumber numberWithInteger:view.document.pageCount],
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-pdf-renderer",
"displayName": "React-Native Pdf Renderer",
"version": "1.3.1",
"version": "1.3.2",
"description": "⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
"main": "src",
"license": "MIT",
Expand Down

0 comments on commit 2f7e215

Please sign in to comment.