NativeScript / nativescript-datetimepicker

Plugin with date and time picking fields
Apache License 2.0
27 stars 26 forks source link

ios: The UIAlertController behavior dismisses the modal by dragging #49

Closed davecoffin closed 4 years ago

davecoffin commented 5 years ago

When you pull down on the spinner to select a date or time and your selection reaches the center when your finger is over the OK or Cancel button, the action is triggered.

Here is a video of the behavior: https://share.getcloudapp.com/6qu0Av6N

The nature of these spinners is you can drag them anywhere on the screen to reach your desired selection without triggering other UI actions. UIAlertController probably isnt a suitable view container for the spinner, as it appears you cannot disable the fact that dragging your finger over the button and releasing will trigger the action regardless of the state of the UI within the alert view.

One potential solution is to not add the UIAlertAction buttons (which trigger this unwanted behavior), but to instead add UIButtons to the messageLabelContainer. You probably couldn't achieve the same native Action Sheet UI look, but the look is far less important that a usable UI in my opinion.

@tgpetrov is unable to commit to fixing this issue, @tjvantoll could you triage? I'd do it myself but my native iOS chops are lacking, I spent a bunch of time on it and managed this haha: https://share.getcloudapp.com/X6uYjLwO

tjvantoll commented 5 years ago

@davecoffin Good catch. I can verify the behavior in this repo’s demo app also. My native iOS chops aren’t great either, so unfortunately I’m not sure what the root cause might be.

davecoffin commented 4 years ago

The cause is that’s the defined behavior of UIAlertViewController, and it doesn’t look like you can override it. It’d have to be rewritten using a regular UIView.

tgpetrov commented 4 years ago

@davecoffin The native UIAlertViewController was updated for iOS13 and it seem like the behavior described above no longer happens (at least not on iOS13).

davecoffin commented 4 years ago

Thats true, thanks for checking in @tgpetrov, and thanks for your work on this plugin ❤️ I'll close this issue.