# NOT RUN {
if (interactive()) {
library(shiny)
library(shinyMobile)
shiny::shinyApp(
ui = f7Page(
title = "Action sheet",
f7SingleLayout(
navbar = f7Navbar("Action sheet"),
br(),
f7Button(inputId = "go", "Show action sheet", color = "red")
)
),
server = function(input, output, session) {
observe({
print(list(
sheetOpen = input$action1,
button = input$button
))
})
observeEvent(input$button, {
if (input$button == 1) {
f7Notif(
text = "You clicked on the first button",
icon = f7Icon("bolt_fill"),
title = "Notification",
titleRightText = "now",
session = session
)
} else if (input$button == 2) {
f7Dialog(
inputId = "test",
title = "Click me to launch a Toast!",
type = "confirm",
text = "You clicked on the second button",
session = session
)
}
})
observeEvent(input$test, {
f7Toast(session, text = paste("Alert input is:", input$test))
})
observeEvent(input$go, {
f7ActionSheet(
grid = TRUE,
id = "action1",
icons = list(f7Icon("info"), f7Icon("lightbulb_fill")),
buttons = data.frame(
text = c('Notification', 'Dialog'),
color = c(NA, NA)
)
)
})
}
)
}
# }
Run the code above in your browser using DataLab