Code example
The code example from the documentation on React in Shiny:
shiny::shinyApp(
ui = shiny::tagList(
shiny.fluent::Checkbox(onChange = shiny.fluent::setInput("checkbox", 2), defaultChecked = TRUE, label = "Checkbox"),
shiny::textOutput("value")
),
server = function(input, output) {
output$value <- shiny::renderText(deparse(input$checkbox))
}
)
Bug description
Upon clicking the button, its value is not displayed.
Expected behavior
Upon clicking the button, TRUE/FALSE should be displayed according to the button's state.
Comments
Using JS() works, however:
shiny::shinyApp(
ui = shiny::tagList(
shiny.fluent::Checkbox(onChange = shiny.fluent::JS("(e, value) => Shiny.setInputValue('checkbox', value)"), defaultChecked = TRUE, label = "Checkbox"),
shiny::textOutput("value")
),
server = function(input, output) {
output$value <- shiny::renderText(deparse(input$checkbox))
}
)
(As does replacing the shiny.fluent::Checkbox() with shiny.fluent::Checkbox.shinyInput("checkbox", value = TRUE, label = "Checkbox"), though with the onChanged event.)
sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS
Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so; LAPACK version 3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
time zone: UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.8.1.1
loaded via a namespace (and not attached):
[1] digest_0.6.36 later_1.3.2 R6_2.5.1 httpuv_1.6.15 fastmap_1.2.0
[6] magrittr_2.0.3 cachem_1.1.0 glue_1.7.0 memoise_2.0.1 htmltools_0.5.8.1
[11] lifecycle_1.0.4 promises_1.3.0 cli_3.6.3 xtable_1.8-4 sass_0.4.9
[16] jquerylib_0.1.4 compiler_4.4.1 shiny.react_0.4.0 shiny.fluent_0.4.0 tools_4.4.1
[21] bslib_0.7.0 mime_0.12 Rcpp_1.0.12 jsonlite_1.8.8 rlang_1.1.4
[26] stringi_1.8.4
Code example
The code example from the documentation on React in Shiny:
Bug description
Upon clicking the button, its value is not displayed.
Expected behavior
Upon clicking the button, TRUE/FALSE should be displayed according to the button's state.
Comments
Using
JS()works, however:(As does replacing the
shiny.fluent::Checkbox()withshiny.fluent::Checkbox.shinyInput("checkbox", value = TRUE, label = "Checkbox"), though with theonChangedevent.)sessionInfo()