Open edwardlavender opened 1 year ago
I'm pretty sure this is a bug in the upstream repo. There is not much I can do with this plugin. Its either start or stop the spinner. I think it could be related to this issue https://github.com/makinacorpus/Leaflet.Spin/issues/12
You could maybe do something like that:
library(shiny)
library(leaflet)
library(leaflet.extras2)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
actionButton("go", "Go"),
leafletOutput("leaf")
)
server <- function(input, output){
mapready <- reactiveVal(NULL)
output$leaf <- renderLeaflet({
m <- leaflet() %>%
addTiles() %>%
leaflet.extras2::addSpinner()
shinyjs::delay(500, mapready(TRUE))
m
})
observe({
req(mapready())
leafletProxy("leaf") %>%
startSpinner(list("lines" = 7, "length" = 40,
"width" = 20, "radius" = 10)) %>%
clearGroup("quk") %>%
addMarkers(data = quakes, ~long, ~lat, group="quk",
popup = ~as.character(mag), label = ~as.character(mag)) %>%
leaflet.extras2::stopSpinner()
})
}
shinyApp(ui, server)
That's great - thanks a lot!
@trafficonese I'll take a look at this and see if we can make it work like it did when this was merged.
@radbasa I'm not sure what you mean. :) Did you maybe write in a wrong issue?
@radbasa I'm not sure what you mean. :) Did you maybe write in a wrong issue?
I'll take a look at the spinner again, and see if the "bug" mentioned above can be fixed.
I have wrapped the example for
?addSpinner
into an R Shiny application., but the spinner does not appear.Here is a reproducible example based on the example given for
?addSpinner
. I expected a spinner to appear during the 'sleep' phase, but no spinner appears.