SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
613 stars 92 forks source link

Can't display a dialog after popover did close (iOS only) #40

Closed 3rdp closed 5 years ago

3rdp commented 5 years ago

Describe the bug In popoverDoneClosing I want to open the Alert dialog. On iOS, the alert closes straight after it showed and after that the app freezes. You can't tap anything, my guess is that popover modal doesn't close properly and overlays the entire screen (like in #16). If you wrap Alert in setTimeout with 0 (zero) interval you may get this behavior after the second hit. You can try it out in this Expo Snack: https://snack.expo.io/HJFjG-G9V With 100 interval, it's pretty much ok, but it still freezes occasionally. Expected bevavior: I call Alert in popoverDoneClosing and it displays without closing and freezing the app, without the need to set a timeout.

Device/Setup Info:

Debug Output This bug does not reproduce when Remote Debug is enabled.

SteffeyDev commented 5 years ago

I ran into this issue as well recently, for a quick fix you can pass in showInModal={false}. This won't make a difference as long as you keep the popover as a child of a top-level view, but will have issues if the popover is nested down a few levels inside views with padding and margin.

I agree this is an issue and I may be able to fix this by tying into the Modal onDismiss prop (https://facebook.github.io/react-native/docs/modal#ondismiss), I'm working on some updates in this area now so keep an eye out for a fix in the next release.

3rdp commented 5 years ago

onDismiss works nice, why not just pass a callback for it and this should wrap this up

SteffeyDev commented 5 years ago

already done, just need to do some testing and documentation

SteffeyDev commented 5 years ago

Ok, just released version 2.0.0, the prop is now onCloseComplete and by default it is mapped to onDismiss. I tested and it can consistently open an Alert with no need to timeout. Check it out when you get the change and let me know how it works for you! I've made a number of other changes, so check out the upgrading section of the readme to see other breaking changes.

3rdp commented 5 years ago

@SteffeyDev awesome. Did you know that onDismiss prop in Modal is iOS-only though?

SteffeyDev commented 5 years ago

I was not aware, let me add a platform check in there...

SteffeyDev commented 5 years ago

Ok fixed (hopefully). v. 2.0.1