peacechen / react-native-modal-selector

A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.
MIT License
369 stars 129 forks source link

[iOS] Cannot open image picker after using ModalSelector #154

Open scousino opened 3 years ago

scousino commented 3 years ago

On iOS, after using the ModalSelector, you cannot open other modals from different libraries. For example, this package breaks both react-native-image-picker and react-native-image-crop-picker's ability to launch a gallery for selecting images/videos.

My inclination is that maybe this library isn't correctly closing and cleaning up a modal after it has been "closed" via cancel or an option being selected.

This is logged in XCode when trying to call launchImageLibrary, after selecting an option from the modal selector, for react-native-image-picker: Attempt to present <UIImagePickerController: 0x10b03dc00> on <RCTModalHostViewController: 0x113f8e0f0> (from <RCTModalHostViewController: 0x113f8e0f0>) whose view is not in the window hierarchy.

which is what makes me think react-native-modal-selector is doing something to RCTModalHostViewController

iOS Version: 14.1 React Native version: 0.62.2 react-native-modal-selector: 2.0.2 react-native-image-picker: 3.0.0-vnext.2

scousino commented 3 years ago

I had to workaround this by manually controlling the visibility of the modal, and only closing it after returning from image/video selection.

scousino commented 3 years ago

I've also opened an issue with react-native-image-picker here: https://github.com/react-native-image-picker/react-native-image-picker/issues/1456 that has additional information on the setup and usage. Although, since I get the same behavior from 2 different image picker packages I'm thinking this package is the true cause of the issue.