Skip to content

Commit 21568a7

Browse files
authored
Merge pull request #538 from princekurt/3.0.0
Fix LimitedLibraryPicker not popping up.
2 parents bdc3c08 + 55d345c commit 21568a7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ios/PhotoLibrary/RNPermissionHandlerPhotoLibrary.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#import "RNPermissionHandlerPhotoLibrary.h"
2+
#import <React/RCTUtils.h>
23

34
@import Photos;
45
@import PhotosUI;
@@ -56,9 +57,9 @@ - (void)openLimitedPhotoLibraryPickerWithResolver:(RCTPromiseResolveBlock _Nonnu
5657
if ([PHPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite] != PHAuthorizationStatusLimited) {
5758
return reject(@"cannot_open_limited_picker", @"Photo library permission isn't limited", nil);
5859
}
59-
60-
UIViewController* rootViewController = [[UIApplication sharedApplication].keyWindow rootViewController];
61-
[[PHPhotoLibrary sharedPhotoLibrary] presentLimitedLibraryPickerFromViewController:rootViewController];
60+
61+
UIViewController *topViewController = RCTPresentedViewController();
62+
[[PHPhotoLibrary sharedPhotoLibrary] presentLimitedLibraryPickerFromViewController:topViewController];
6263

6364
resolve(@(true));
6465
} else {

0 commit comments

Comments
 (0)