shinyMobile icon indicating copy to clipboard operation
shinyMobile copied to clipboard

Popup/Popver/Notif not working

Open jpiaskowski opened this issue 2 years ago • 8 comments

Hello, I've tried running this example as is and with many attempted fixes. It does not display the popup or the toast window. This example is taken straight from the documentation for shinyMobile::f7Popup. I've tried in an Rstudio window (on Mac OSX and Windows 10) and on a Firefox browser with the popup blocker disabled.

 library(shiny)
 library(shinyMobile)
 shinyApp(
   ui = f7Page(
     title = "Popup",
     f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Popup",
        hairline = FALSE,
        shadow = TRUE
      ),
      f7Button("togglePopup", "Toggle Popup"),
      f7Popup(
       id = "popup1",
       title = "My first popup",
       f7Text("text", "Popup content", "This is my first popup ever, I swear!"),
       verbatimTextOutput("popupContent")
      )
     )
   ),
   server = function(input, output, session) {

    output$popupContent <- renderPrint(input$text)

    observeEvent(input$togglePopup, {
     updateF7Popup(id = "popup1")
    })

    observeEvent(input$popup1, {

     popupStatus <- if (input$popup1) "opened" else "closed"

     f7Toast(
      position = "top",
      text = paste("Popup is", popupStatus)
     )
    })
   }
 )
}

f7Popovers() and f7Notif() have the same problem. Does shinyMobile require a specific version of shiny or F7?

jpiaskowski avatar Aug 27 '22 00:08 jpiaskowski

Working just fine for me with latest CRAN release (0.9.1):

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.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   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyMobile_0.9.1 shiny_1.7.1      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       digest_0.6.29    later_1.3.0      mime_0.12        R6_2.5.1        
 [6] jsonlite_1.8.0   lifecycle_1.0.1  xtable_1.8-4     magrittr_2.0.2   cachem_1.0.6    
[11] rlang_1.0.4      cli_3.2.0        rstudioapi_0.13  promises_1.2.0.1 jquerylib_0.1.4 
[16] bslib_0.3.1      ellipsis_0.3.2   tools_4.2.1      httpuv_1.6.5     fastmap_1.1.0   
[21] compiler_4.2.1   htmltools_0.5.2  sass_0.4.0

https://user-images.githubusercontent.com/18291543/187028619-56892ba6-5836-475f-b9f8-8a68eb057c12.mov

What version are you currently running?

DivadNojnarg avatar Aug 27 '22 11:08 DivadNojnarg

Thank you for looking into this. And thank you for the session info, this helped me diagnose the problem.

I did have the latest version of shinyMobile installed, but it seems like the problem is that I was also running the latest version of shiny (1.7.2). When I rolled back to shiny 1.7.1, popups, popovers, notifs are working as intended. Here is their change log.

jpiaskowski avatar Aug 29 '22 15:08 jpiaskowski

@jpiaskowski Could you try again and let me know? I also have shiny 1.7.2.

DivadNojnarg avatar Sep 04 '22 05:09 DivadNojnarg

I just tried it with a fresh install of both packages (from CRAN) and still no pop-ups or popovers.

jpiaskowski avatar Sep 06 '22 21:09 jpiaskowski

shinyMobile 1.0.0 is not yet on CRAN, CRAN still has the old version:

devtools::install_github("RinteRface/[email protected]")

DivadNojnarg avatar Sep 07 '22 04:09 DivadNojnarg

Oh gosh, sorry, that is a bit obvious in retrospect. I'll check tomorrow.

jpiaskowski avatar Sep 07 '22 04:09 jpiaskowski

I actually just got this error:

Error in session$ns(id) : attempt to apply non-function

I'm confused what is going on and don't have time to troubleshoot this today. When I updated to shinyMobile 1.0.0, that did prompt updating several packages, so perhaps that is related...?

This is in a fresh R session and the error persisted when I tried to run other {shinyMobile} examples (that previously worked).

Here is the sessionInfo():

R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6.7

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyMobile_1.0.0.9000 shiny_1.7.2           

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9       withr_2.5.0      digest_0.6.29    later_1.3.0      mime_0.12        R6_2.5.1         jsonlite_1.8.0  
 [8] lifecycle_1.0.1  xtable_1.8-4     magrittr_2.0.3   rlang_1.0.5      cli_3.3.0        rstudioapi_0.13  promises_1.2.0.1
[15] ellipsis_0.3.2   tools_4.2.0      httpuv_1.6.5     fastmap_1.1.0    compiler_4.2.0   htmltools_0.5.3 

jpiaskowski avatar Sep 07 '22 22:09 jpiaskowski

This is probably due to some changes in {shinyMobile} particularly the f7Popup which is now called from the server part and not the UI, like f7Notif and other alert elements. See an example here: https://github.com/RinteRface/shinyMobile/blob/rc-1.0.0/R/f7Popup.R#L49.

DivadNojnarg avatar Sep 14 '22 15:09 DivadNojnarg

I am also having some issues with popups after updating. The popups are not showing up at all in my app. The example for f7Popup() works for me alright however, which makes it hard to pinpoint the issue.

I have been using the popups like sheets, but I prefer the popups for my use case because I want the most recently opened one to hide the previous one, which didn't seem possible with sheets (they will only open as far as there is content so you can still see the bottom one sometimes). Once the user finishes the workflow, I can toggle them all closed (or if they need to go back, they just close the one on top and change what they need to change on the one below it, and when they hit the submit button, the next one pops back on top again). What I am describing above works much better the way you had it set up previously, by setting the popup up in the UI and toggling in the server. Is there an alternative I can use for this, or a way to use sheets that cover the whole screen every time?

laldew avatar Nov 29 '22 22:11 laldew