Skip to content

Commit fb37d3f

Browse files
authored
Merge pull request #235 from pygd/patch-1
fix(iOS): open from available presentedViewController
2 parents ec799c1 + ae01dde commit fb37d3f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/imagepicker.ios.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ export class ImagePicker extends data_observable.Observable {
2828
}
2929

3030
get hostController() {
31-
return this.hostView ? this.hostView.viewController : UIApplication.sharedApplication.keyWindow.rootViewController;
31+
let vc = this.hostView ? this.hostView.viewController : UIApplication.sharedApplication.keyWindow.rootViewController;
32+
while (
33+
vc.presentedViewController
34+
&& vc.presentedViewController.viewLoaded
35+
&& vc.presentedViewController.view.window
36+
) {
37+
vc = vc.presentedViewController;
38+
}
39+
return vc;
3240
}
3341

3442
constructor(options: Options = {}, hostView: View) {

0 commit comments

Comments
 (0)