Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
50 lines (46 loc) · 1.52 KB

File metadata and controls

50 lines (46 loc) · 1.52 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
library(shiny)
library(flipcard)
ui <- fluidPage(
tags$script(HTML(
"
// set up global state observable that we can reference with flipcardInput
state = mobx.observable({isFlipped: true});
// set up a Shiny message handler so we can change the state from R
Shiny.addCustomMessageHandler('flip', function(message) {
state.isFlipped = !state.isFlipped;
});
"
)),
titlePanel(tags$span("reactR Input Example with ", tags$a(href = "https://mobx.js.org/intro/overview.html", "mobx"))),
wellPanel(style = "width:400px;", "In the latest version of reactR, I added mobx. Here we leverage the value argument to reference a global observable state. A user can now click the card to flip."),
flipcardInput(
"flipInput",
default = "state",
configuration = list(
containerStyle = list(width = "400px", height = "400px"),
front = list(
tag = "img",
props = list(
src = "//static.pexels.com/photos/59523/pexels-photo-59523.jpeg",
style = list(height = "100%", width = "100%")
),
content = NULL
),
back = list(
tag = "img",
props = list(
src = "//img.buzzfeed.com/buzzfeed-static/static/2014-04/enhanced/webdr06/4/16/enhanced-11136-1396643149-13.jpg?no-auto",
style = list(height = "100%", width = "100%")
),
content = NULL
)
)
)
)
server <- function(input, output, session) {
# observe({
# invalidateLater(2000, session)
# session$sendCustomMessage("flip", list())
# })
}
shinyApp(ui, server)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.