shinyFeedback 不适用于 shinyWidgets 的 autonumericInput 函数

shinyFeedback not working with shinyWidgets' autonumericInput function

我正在尝试使用 shinyFeedback 为我的应用程序的用户提供反馈。我使用来自 shinyWidgets 的数字输入的自定义货币格式。这两个似乎不能一起工作。下面是一个 reprex,显示 shinyFeedbacknumericInput 一起正常工作,但不能与 autonumericInput.

一起工作

有没有什么技巧可以让这两个一起工作?

library(shiny)
library(shinyWidgets)
library(shinyFeedback)

ui <- fluidPage(
  useShinyFeedback(),
  numericInput(
    "numeric_input", "numeric_input",
    value = 1e6, min = -Inf, max = Inf
  ),
  autonumericInput(
    "autonumeric_input", "autonumeric_input",
    value = 1e6, currencySymbol = "€", currencySymbolPlacement = "p", decimalPlaces = 0, digitGroupSeparator = " "
  ),
)

server <- function(input, output, session) {

  observeEvent(input$numeric_input, {
    feedbackWarning("numeric_input", show = input$numeric_input >= 0, text = "Hello numeric_input")
  })
  
  observeEvent(input$autonumeric_input, {
    feedbackWarning("autonumeric_input", show = input$autonumeric_input >= 0, text = "Hello autonumeric_input")
  })

}

shinyApp(ui, server)

这可能是解决此类问题的解决方法。

library(shiny)
library(shinyWidgets)
library(tidyverse)

ui <- fluidPage(
  
  tags$head(
    tags$style(
      HTML(".shiny-notification {
             position:fixed;
             top: calc(1%);
             left: calc(1%);
             }
             "
      )
    )
  ),
  
  br(), br(), br(), br(),
  autonumericInput(
    "autonumeric_input", "autonumeric_input",
    value = 0, minimumValue = 0, maximumValue = 1, currencySymbol = "€", currencySymbolPlacement = "p", decimalPlaces = 0, digitGroupSeparator = " "
  ),
)

server <- function(input, output, session) {

  observeEvent(input$autonumeric_input, {
    
    showNotification(duration = 1.5, "Notification", type = "warning")
    
  })

}

shinyApp(ui, server)