Skip to content

Commit

Permalink
fix(ios): make ActionSheetOptionStyle.Cancel show cancel button (#2496)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Feb 27, 2020
1 parent 178eb65 commit d120021
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ios/Capacitor/Capacitor/Plugins/Modals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ public class CAPModalsPlugin : CAPPlugin {
for (index, option) in options.enumerated() {
let style = option["style"] as? String ?? "DEFAULT"
let title = option["title"] as? String ?? ""

let action = UIAlertAction(title: title, style: style == "DESTRUCTIVE" ? .destructive : .default, handler: { (action) -> Void in
var buttonStyle: UIAlertAction.Style = .default
if style == "DESTRUCTIVE" {
buttonStyle = .destructive
} else if style == "CANCEL" {
buttonStyle = .cancel
}
let action = UIAlertAction(title: title, style: buttonStyle, handler: { (action) -> Void in
call.success([
"index": index
])
Expand Down

0 comments on commit d120021

Please sign in to comment.