android - R闪亮的移动应用程序:防止PullToRefresh
问题描述
上下文:我正在使用shinyMobile包开发一个移动 Shiny 应用程序,它是著名的 framework7 HTML 模板的包装器。
在我的应用程序中,用户必须使用多个下拉列表在第一个选项卡上选择属性,然后在其他选项卡上生成一些输出。每个选项卡都需要用户上下滚动才能访问所有内容,在此过程中,通常会触发“拉动刷新”功能。
这真的很烦人,因为整个属性选择和输出都丢失了,用户不得不从头开始。
我尝试了什么:基于这个指向这个谷歌开发者页面的 SO线程,我尝试将 CSS overscroll-behavior 属性设置为with: 。问题:它对我不起作用!(在 Chrome Android 上测试)contain
body {overscroll-behavior-y: contain;}
最小的可重现示例:
默认应用,部署在这里
library(shiny);library(shinyMobile)
shiny::shinyApp(
ui = f7Page(
f7Card(
h5('try to pull to refresh. normally it should work.')
)
),
server = function(input, output) {}
)
据说是固定的应用程序,部署在这里
library(shiny);library(shinyMobile)
shiny::shinyApp(
ui = f7Page(
tags$style(type='text/css', '.body{overscroll-behavior-y: contain;}'),
f7Card(
h5('try to pull to refresh. Normally it should not work.')
)
),
server = function(input, output) {}
)
希望你们能重现我的问题并找出问题所在!!!
解决方案
您可能希望将您的 css 部分更改为:html,body{overscroll-behavior-y: contain;}
,请参阅https://stackoverflow.com/a/42509310/3502164。
然后它适用于我的手机(android chrome)。
可重现的例子:
library(shiny)
library(shinyMobile)
app <- shiny::shinyApp(
ui = f7Page(
tags$style(type='text/css', 'html,body{overscroll-behavior-y: contain;}'),
f7Card(
h5('try to pull to refresh. Normally it should not work.')
)
),
server = function(input, output) {}
)
# use host config to access app from mobiles in the same network
shiny::runApp(appDir = app, host = '0.0.0.0')
推荐阅读
- javascript - 变量为本地时如何创建删除功能
- multithreading - 在 JMeter 线程组内共享变量
- python - 如何在没有回溯的情况下执行异常?
- java - 为什么 Spring security Authentication 返回 Null 身份验证对象?
- .htaccess - 使用 .htaccess 将 /category/item/id-title.html 重定向到 /category/title
- python - 属性错误:“AioClientCreator”对象没有属性“_register_lazy_block_unknown_fips_pseudo_regions”
- python-3.x - 在 Django 中,如何构造我的查询集以按时间过滤时间片?
- python - 获取通用替换类型
- vagrant - VirtualBox 和 Vagrant
- r - 从列表列表到保存列表编号的数据框