Reputation: 101
I am having trouble getting a leaflet map to display in R Shiny when using the fullPage package/theme. Anyone have any idea what could be going on here? Code works in all the othe Shiny themes I use, so I'm guessing it's something specific to fullPage? I only started playing around with this theme yesterday so certainly possible I'm missing something.
Full Example Below:
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(fullPage)
library(leaflet)
library(highcharter)
library(glue)
library(tidyverse)
img1 <- "https://live.staticflickr.com/8081/8312400018_f53f23dac9_b.jpg"
# Define UI for application that draws a histogram
options <- list(
sectionsColor = c('#F5F5F5'),
parallax = TRUE
)
ui <- fullPage(
menu = c("Home" = "home",
"About" = "about",
"Analytics" = "analytics",
"Buy" = "section3",
"Sell" = "section4",
"Rent" = "section5",
"Contact" = "contact"),
opts = options,
fullSectionImage(
img = img1,
menu = "home"
),
fullSection(
center = FALSE,
menu = "about",
br(),
br(),
fullContainer(
tags$h1("Example")
),
fullContainer(
fullRow(
fullColumn(
p('Some text.'),
br(),
p('More text.')
)
)
),
fullRow(
pre(
code(
img(src = 'https://pics.harstatic.com/office/395001.png', width = '50%', height = 'auto')
)
)
)
),
fullSection(
menu = "analytics",
fullRow(
fullColumn(
h3("Column 1"),
selectInput(
"dd",
"data points",
choices = c(10, 20, 30)
)
),
fullColumn(
plotOutput("hist")
),
fullColumn(
plotOutput("plot")
)
)
),
fullSection(
menu = "section3",
fullSlide(
fullContainer(
center = TRUE,
h3("With container"),
plotOutput("slideplot2"),
shiny::verbatimTextOutput("containerCode")
)
),
fullSlide(
center = TRUE,
h3("Without container"),
plotOutput("slideplot1")
)
),
fullSectionPlot(
menu = "section4",
center = TRUE,
"fp",
h3("Background plots"),
fullContainer(
sliderInput(
"fpInput",
label = "Input",
min = 10,
max = 100,
value = 74
)
)
),
fullSection(
menu = "section5",
fullSlidePlot(
"slideSectionPlot1",
center = TRUE,
h1("Slide background plot")
),
fullSlidePlot(
"slideSectionPlot2"
)
),
fullSection(
menu = "contact",
fullContainer(
leaflet::leafletOutput('map')
)
)
)
server <- function(input, output, session){
output$map <- leaflet::renderLeaflet({
leaflet() %>%
addTiles(group = "OSM (default)")
}
)
}
shinyApp(ui, server)
Upvotes: 1
Views: 209