ActionSheetPicker-3.0
ActionSheetPicker-3.0 copied to clipboard
cancel block not called if user taps outside action sheet
I am using an ActionSheetDatePicker with a cancel block on an iPhone. If the user hits the Cancel button, this is called. However, if the user taps outside the the action sheet, the action sheet is hidden, but the cancel block is not executed, so my code doesn't have any (reasonable) way of knowing that the user canceled.
After #528 is merged, this issue will be fixed
I hadn't seen .tapDismissAction in the API, so wasn't using it. I have updated my code to set it to .cancel, but (as I assume you know) I still didn't get notified when the user tapped above the action sheet. Not reported here, the same thing happens in popover mode on an iPad. Let me know if you want me to create a separate issue for the iPad popover problem.
I confirm: tapDismissAction is not called, if it is not .none. I've tracked it to the fact that when adding gesture recognisers in AbstractActionSheetPicker showActionSheetPicker. _actionSheet.window is always nil, since SWActionSheet window is never called
@Jeepston I agree, my branch #528 is not yet merged so you're facing the issue. Can you please specify my branch in your Podfile for ActionSheetPicker and test once?
@noorulain17 I would be happy to, if you provide me with the instructions how to specify a brunch in Podfile (never done it before)
Hey @Jeepston you can use the following code to test on your app
pod 'ActionSheetPicker-3.0', :git => 'https://github.com/skywinder/ActionSheetPicker-3.0.git', :branch => 'broken_tapDismissAction_fix'
You can learn more about changing branch/tag, etc. in Podfile from here
@noorulain17 I've tested your branch - the fix works on iPhones, but unfortunately, not on iPads...
Thanks @Jeepston for your feedback. I'll fix that on iPad too. Give me few days.
I have the same problem and noticed #528. But it have not been merged when 2 month passed
The PR is pending, https://github.com/skywinder/ActionSheetPicker-3.0/pull/528 would easily solve it.
I'm having this issue too has it been fixed
@hechukwu the fix has been merged to develop branch, you can test is using
pod 'ActionSheetPicker-3.0', :git => 'https://github.com/skywinder/ActionSheetPicker-3.0.git', :branch => 'develop'
@skywinder or I will release a new version of the library in a few days
Thank you
Didn't seem to work. When I tap outside the action sheet and it dismisses when I try to open it again it doesn't work
if !pickerIsActive { pickerIsActive = true let subspaceName = self.subspaces.map { $0.name } let title = subspaces.count == 0 ? "There are no subspaces" : "Select Subspace" let initialIndex = 0 let picker = ActionSheetStringPicker.show(withTitle: title, rows: subspaceName as [Any], initialSelection: initialIndex, doneBlock: { picker, index, value in self.pickerIsActive = false
if let subspaceName = value as? String {
self.subspaceTextField.text = subspaceName
self.selectedSubspace = self.subspaces[index]
}
return
}, cancel: { actionMultipleStringCancelBlock in
self.pickerIsActive = false
return
}, origin: self.spaceTextField)
if #available(iOS 13.0, *) {
picker?.toolbarButtonsColor = .label
picker?.pickerBackgroundColor = .systemGray6
picker?.toolbarBackgroundColor = .systemGray6
picker?.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.label]
}
}
@noorulain17 I'm using the branch but it's still not working
@hechukwu thanks for the update. I'll work on this on the weekend. Or if you would like to open the fix PR, you're more than welcome :) Thanks for using ActionSheetPicker.
@noorulain17 sure thing bro. This is a great tool been using for most of my projects.
@noorulain17 Thanks for the reply. It seems this issue is not fixed on iPhone or iPad. Please help to fix/merge the code if possible. Thanks!
Any update on this? thanks.