Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions ios/RNPrint/RNPrint.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ -(void)launchPrint:(NSData *) data
}
}];
} else if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad
UIView *view = [[UIApplication sharedApplication] keyWindow].rootViewController.view;
UIView *view = RCTKeyWindow().rootViewController.view;
[printInteractionController presentFromRect:view.frame inView:view animated:YES completionHandler:completionHandler];
} else { // iPhone
[printInteractionController presentAnimated:YES completionHandler:completionHandler];
Expand Down Expand Up @@ -152,7 +152,7 @@ -(void)launchPrint:(NSData *) data
};

if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad
UIView *view = [[UIApplication sharedApplication] keyWindow].rootViewController.view;
UIView *view = RCTKeyWindow().rootViewController.view;
CGFloat _x = 0;
CGFloat _y = 0;
if (options[@"x"]){
Expand All @@ -170,11 +170,7 @@ -(void)launchPrint:(NSData *) data
#pragma mark - UIPrintInteractionControllerDelegate

-(UIViewController*)printInteractionControllerParentViewController:(UIPrintInteractionController*)printInteractionController {
UIViewController *result = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
while (result.presentedViewController) {
result = result.presentedViewController;
}
return result;
return RCTPresentedViewController();
}

-(void)printInteractionControllerWillDismissPrinterOptions:(UIPrintInteractionController*)printInteractionController {}
Expand Down