Skip to content

Commit 89ba83e

Browse files
authored
Fix for iPad
Fix for the iPad, accept also another argument that will be the rect that should be referenced to display the popup.
1 parent c3411e7 commit 89ba83e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ios/RNFileOpener/RNFileOpener.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ - (dispatch_queue_t)methodQueue
1111

1212
RCT_EXPORT_MODULE();
1313

14-
RCT_REMAP_METHOD(open, filePath:(NSString *)filePath fileMine:(NSString *)fileMine
14+
RCT_REMAP_METHOD(open, filePath:(NSString *)filePath fileMine:(NSString *)fileMine fromRect:(CGRectMake)rect
1515
resolver:(RCTPromiseResolveBlock)resolve
1616
rejecter:(RCTPromiseRejectBlock)reject)
1717
{
@@ -31,6 +31,11 @@ - (dispatch_queue_t)methodQueue
3131
UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
3232

3333
BOOL wasOpened = [self.FileOpener presentOpenInMenuFromRect:ctrl.view.bounds inView:ctrl.view animated:YES];
34+
35+
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
36+
{
37+
wasOpened = [self.FileOpener presentOptionsMenuFromRect:rect inView:ctrl.view animated:YES];
38+
}
3439

3540
if (wasOpened) {
3641
resolve(@"Open success!!");
@@ -41,4 +46,4 @@ - (dispatch_queue_t)methodQueue
4146

4247
}
4348

44-
@end
49+
@end

0 commit comments

Comments
 (0)