library(shiny)
library(shinyalert)
shinyApp(
ui = fluidPage(
# useShinyalert()
),
server = function(input, output) {
shinyalert(html = TRUE, text = tagList(
textInput("name", "What's your name?", "Dean"),
numericInput("age", "How old are you?", 30)
))
})
Before R-4.3, this now warns
Warning in html && nzchar(params[["text"]]) :
'length(x) = 2 > 1' in coercion to 'logical(1)'
and on R-4.3 or newer, this is an error. Regardless, the modal does not appear.
If I uncomment useShinyalert(), I get the message
Warning: Good news!
You don't need to call `useShinyalert()` anymore. Please remove this line from your code.
If you really want to pre-load {shinyalert} to the UI for any reason, use:
`useShinyalert(force = TRUE)`
and it still does not work. When I add force=TRUE then the alert appears on R-4.2.3 with the aforementioned warning. On R-4.3 it fails completely.
The length issue can be resolved by wrapping the tagList with as.character.
library(shiny)
library(shinyalert)
shinyApp(
ui = fluidPage(
useShinyalert(force = TRUE)
),
server = function(input, output) {
shinyalert(html = TRUE, text = as.character(tagList(
textInput("name", "What's your name?", "Dean"),
numericInput("age", "How old are you?", 30)
)))
})
If I use useShinyalert() or if I comment it out completely, the alert does not appear.
This is on shinyalert_3.0.0 with shiny_1.7.4 on R-4.2.3.
Per the docs, this should work:
Before R-4.3, this now warns
and on R-4.3 or newer, this is an error. Regardless, the modal does not appear.
If I uncomment
useShinyalert()
, I get the messageand it still does not work. When I add
force=TRUE
then the alert appears on R-4.2.3 with the aforementioned warning. On R-4.3 it fails completely.The
length
issue can be resolved by wrapping thetagList
withas.character
.If I use
useShinyalert()
or if I comment it out completely, the alert does not appear.This is on
shinyalert_3.0.0
withshiny_1.7.4
on R-4.2.3.(Motivated by https://stackoverflow.com/q/76434476/3358272.)