Skip to content

f7Picker: Empty value / choices breaks shinyjs #104

@Seyphaton

Description

@Seyphaton

Hi,

thanks (again) for your great package.
Unfortunately there is a bug in the f7Picker:
If the value is NULL shinyjs is broken.

Minimal working example:

 library(shinyMobile)
 library(shinyjs)
 
 shiny::shinyApp(
  ui = shinyMobile::f7Page(
    title = "My app",
    shinyjs::useShinyjs(),
    shinyMobile::f7SingleLayout(
      navbar = shinyMobile::f7Navbar(
        title = "Single Layout",
        hairline = FALSE,
        shadow = TRUE
      ),
      toolbar = f7Toolbar(
        position = "bottom",
        f7Link(label = "Link 1", src = "https://www.google.com"),
        f7Link(label = "Link 2", src = "https://www.google.com", external = TRUE)
      ),
      # main content
      shinyMobile::f7Shadow(
        intensity = 10,
        hover = TRUE,
            shiny::div(
                shinyMobile::f7Picker(inputId = "test1", label = "this works", choices = c("Empty"), value =  "Empty",  placeholder = "qwerty")
        
                #This breaks all Javascript: 
                ,shinyMobile::f7Picker(inputId = "test2", label = "this one breaks shinyjs", choices = c("Empty"), value =  NULL,  placeholder = "abcdefg")
            )
      )
    )
  ),
  server = function(input, output) {
        shinyjs::runjs("console.log('shinyjs broken if this is not logged')")
  }
 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions