# Picker input
if(interactive()){
library(shiny)
library(shinyMobile)
shinyApp(
ui = f7Page(
title = "My app",
f7SingleLayout(
navbar = f7Navbar(title = "f7Picker"),
f7Picker(
inputId = "mypicker",
placeholder = "Some text here!",
label = "Picker Input",
choices = c('a', 'b', 'c')
),
textOutput("pickerval")
)
),
server = function(input, output) {
output$pickerval <- renderText(input$mypicker)
}
)
}
# Update picker input
if (interactive()) {
library(shiny)
library(shinyMobile)
shinyApp(
ui = f7Page(
title = "My app",
f7SingleLayout(
navbar = f7Navbar(title = "Update picker"),
f7Card(
f7Button(inputId = "update", label = "Update picker"),
f7Picker(
inputId = "mypicker",
placeholder = "Some text here!",
label = "Picker Input",
choices = c('a', 'b', 'c')
),
verbatimTextOutput("pickerval"),
br(),
f7Button(inputId = "removeToolbar", label = "Remove picker toolbar", color = "red")
)
)
),
server = function(input, output, session) {
output$pickerval <- renderText(input$mypicker)
observeEvent(input$update, {
updateF7Picker(
inputId = "mypicker",
value = "b",
choices = letters,
openIn = "sheet",
toolbarCloseText = "Prout",
sheetSwipeToClose = TRUE
)
})
observeEvent(input$removeToolbar, {
updateF7Picker(
inputId = "mypicker",
value = "b",
choices = letters,
openIn = "sheet",
toolbar = FALSE
)
})
}
)
}
Run the code above in your browser using DataLab