Bug: native view issues with other modals
Hi,
I am running into some issues with the modal presentation and third party libraries (and React Navigation Modal presentation.) As soon as the Picker closes, it automatically closes EVERY other open modal in my app.
I did find a workaround for my react-navigation modal by changing presentation (using react-native-screens) from "modal" to "containedModal". This somehow prevents my modal from closing (prob. other hierarchy which doesn't collide with your "getTopMostViewController" and dismissPicker function) , but I have other third party modals opening after the selection which get closed as soon as this picker closes. I guess this library is messing around with the native navigation controller.
Currently, I have to wrap a setTimeout with 1s to my "openVideoEditor" function (which opens a third party video editor as a modal) after I received a response to make sure ImagePicker has been closed.
This is working for now, but suboptimal, since I am using a magic number and this might not be reliable. Furthermore, the modal should not mess around with other modals.
Another option would be to introduce a prop like "waitAnimationEnd" which could be set to true. This should resolve/reject the promise only after the modal has been closed (eg animation ended). This is still kinda hacky but at least prevents us to use setTimeout. I would prefer a proper fix for that. Would love to make a PR, but I am not a native nor swift developer.
This library does the same: https://github.com/ivpusic/react-native-image-crop-picker https://github.com/ivpusic/react-native-image-crop-picker/blob/633769bf0797266f063bc34f51565d519e0b5474/ios/src/ImageCropPicker.m#L87-L97
Another option would be to introduce a prop like "waitAnimationEnd" which could be set to true. This should resolve/reject the promise only after the modal has been closed (eg animation ended). This is still kinda hacky but at least prevents us to use setTimeout. I would prefer a proper fix for that. Would love to make a PR, but I am not a native nor swift developer.
Thanks for your contribution. I will look to fix this error.
Any progress on this?