{"action":"created","issue":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/128","repository_url":"https://api.github.com/repos/marcshilling/react-native-image-picker","labels_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/128/comments","events_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/128/events","html_url":"https://github.com/marcshilling/react-native-image-picker/pull/128","id":138309051,"number":128,"title":"Invoke response callbacks after UIImagePickerController dismiss animation has completed","user":{"login":"pjcabrera","id":199736,"avatar_url":"https://avatars.githubusercontent.com/u/199736?v=3","gravatar_id":"","url":"https://api.github.com/users/pjcabrera","html_url":"https://github.com/pjcabrera","followers_url":"https://api.github.com/users/pjcabrera/followers","following_url":"https://api.github.com/users/pjcabrera/following{/other_user}","gists_url":"https://api.github.com/users/pjcabrera/gists{/gist_id}","starred_url":"https://api.github.com/users/pjcabrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjcabrera/subscriptions","organizations_url":"https://api.github.com/users/pjcabrera/orgs","repos_url":"https://api.github.com/users/pjcabrera/repos","events_url":"https://api.github.com/users/pjcabrera/events{/privacy}","received_events_url":"https://api.github.com/users/pjcabrera/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-03T21:58:23Z","updated_at":"2016-03-04T19:37:20Z","closed_at":"2016-03-04T14:27:46Z","pull_request":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/pulls/128","html_url":"https://github.com/marcshilling/react-native-image-picker/pull/128","diff_url":"https://github.com/marcshilling/react-native-image-picker/pull/128.diff","patch_url":"https://github.com/marcshilling/react-native-image-picker/pull/128.patch"},"body":"In my app, I am displaying a React Native Alert in the response callback from RNImagePicker. This works fine on iPhone and iPod touch. But on iPad, the Alert doesn't show, and I get a warning in the Xcode console:\r\n\r\n`Warning: Attempt to present <UIAlertController: 0x7ad6ba00> on <UIImagePickerController: 0x7ac63c00> whose view is not in the window hierarchy!`\r\n\r\nI can reproduce this in iPads with different models and in the iPad simulator. The Alert doesn't show and this warning only occurs if you display an React Native Alert in the response callback in iOS on iPad. Everything works as intended on iPhone & iPod touch devices.\r\n\r\nI believe what is happening is that the React Native Alert iOS implementation sets a reference to the UIImagePickerController as its popoverViewController, but this UIImagePickerController is not part of the RN view hierarchy, which leads to the iOS warning and the Alert not showing.\r\n\r\nThe fix is to make sure the response callback is only invoked after the UIImagePickerController dismiss animation has completed. With the UIImagePickerController gone, the React Native Alert iOS implementation uses the RN RootViewController as the popoverViewController.\r\n\r\nI tested this PR on different model iPads and iPhones, on iOS 8.x and iOS 9.x, and the expected result now occurs on both device types without warnings in the Xcode console. Also, response callbacks without use of Alerts continue to work as before."},"comment":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/comments/192431767","html_url":"https://github.com/marcshilling/react-native-image-picker/pull/128#issuecomment-192431767","issue_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/128","id":192431767,"user":{"login":"pjcabrera","id":199736,"avatar_url":"https://avatars.githubusercontent.com/u/199736?v=3","gravatar_id":"","url":"https://api.github.com/users/pjcabrera","html_url":"https://github.com/pjcabrera","followers_url":"https://api.github.com/users/pjcabrera/followers","following_url":"https://api.github.com/users/pjcabrera/following{/other_user}","gists_url":"https://api.github.com/users/pjcabrera/gists{/gist_id}","starred_url":"https://api.github.com/users/pjcabrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjcabrera/subscriptions","organizations_url":"https://api.github.com/users/pjcabrera/orgs","repos_url":"https://api.github.com/users/pjcabrera/repos","events_url":"https://api.github.com/users/pjcabrera/events{/privacy}","received_events_url":"https://api.github.com/users/pjcabrera/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T19:37:19Z","updated_at":"2016-03-04T19:37:19Z","body":"Thanks for reviewing and releasing a new npm package so quickly!"}}