ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.14k stars 1.56k forks source link

Image Picker not opening #951

Open jlovatt123 opened 5 years ago

jlovatt123 commented 5 years ago

Version

Tell us which versions you are using:

Platform

Tell us to which platform this issue is related

Expected behaviour

After calling ImagePicker.openPicker({ multiple: true, maxFiles: 30, includeBase64: true, mediaType: 'photo' }) I expect the image picker to open on top of my current screen to allow me to select images

Actual behaviour

I get the permission dialog the first time, but then nothing happens. After digging in the code, the native method getRootVc in ImageCropPicker.m always returns null. If I switch the first line of code in that method to UIViewController *root = [[[UIApplication sharedApplication] keyWindow] rootViewController]; it works as expected. Is there a reason this the original code would return nil while keyWindow returns the correct root ViewController?

dphaener commented 5 years ago

@jlovatt123 check out this thread: https://github.com/ivpusic/react-native-image-crop-picker/issues/893

I had this same issue and it was because I had a react-native modal that was not fully closed prior to the one that this library uses tried to open so it never opened. I had to use a set timeout to get it to work properly.