Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] map not showing in modal second click #266

Open
noamanemobidata opened this issue Apr 23, 2023 · 1 comment
Open

[bug] map not showing in modal second click #266

noamanemobidata opened this issue Apr 23, 2023 · 1 comment

Comments

@noamanemobidata
Copy link

Hi! The map is not displayed inside a modal on the second invocation. (click modal button for the second time, it works the first time )

library(googleway)

ui <- fluidPage(
  actionButton("sect",label = "show")
)

server <- function(input, output, session){
  
  
    output$mapl <- renderGoogle_map({
    
    google_map( update_map_view = F,
                styles = map_styles()$silver,
                key = map_key,
                geolocation = F, height = "100%",
                search_box = F,
                # libraries = c('visualization', 'geometry','places'),
                scale_control = T,
                street_view_control = F,
                map_type_control = F,
                rotate_control = T,
                zoom_control = T,
                fullscreen_control = F,
                location = c(50.6062442, 3.1148086)
    )%>%
      add_drawing(drawing_modes = c("polygon"))
    
  })
  
  
  observeEvent(input$sect,{

    showModal(session = session, 
      
      
        modalDialog(size = 'l',easyClose = T , 
                    google_mapOutput('mapl')
      
    )
    )
    
  })
  
}
shinyApp(ui, server)

@dcooley
Copy link
Collaborator

dcooley commented Apr 23, 2023

If you look in the javascript console of a browser you get a clue

Uncaught duplicate binding for mapl

Screenshot 2023-04-23 at 8 22 54 pm

If you follow the link to the source of the error you can see where it's thrown from

Screenshot 2023-04-23 at 8 23 13 pm

Notice there is also a unbindOutput function. I recommend looking in to how to unbind an output after dismissing the modal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants