提问人:Federico 提问时间:12/19/2020 最后编辑:Federico 更新时间:12/31/2020 访问量:594
Facebook 弹出窗口在 WebView 中不可滚动 - React native
Facebook pop up not scrollable in WebView - React native
问:
我的应用程序有一个 WebView,在 Android 和 iOS 中运行良好,但在某些情况下,会显示以下要求输入 cookie 的 Facebook 弹出窗口,并且无法向下滚动。然后整个 Web 视图不可用。
代码非常简单:
<WebView
source={{
uri: url
}}/>
我怎样才能让它也可滚动? 谢谢!
答:
0赞
Florin Dobre
12/25/2020
#1
一个可能的解决方案是将 webview 包含在 ScrollView 中
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<WebView
source={{
uri: url
}}/>
</ScrollView>
其他可能的解决方案可能是使用:
https://github.com/iou90/react-native-autoheight-webview#readme
注意:如果 webview 已经包含在检查中,是否设置一些或一些会使模式可滚动到最后。ScrollView
bottomPadding
contentInset
0赞
John
12/31/2020
#2
分辨率太小,无法显示整个弹出窗口。
您可以使用以下方法进行缩小:
webview.setInitialScale(1);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
或者,您可以编辑网页本身以使用页面的视口元缩小,使用 CSS 缩小弹出窗口,或者通过将元素的 css 设置为以下元素来向该特定元素添加滚动条:
#target{
max-height:100%;
overflow:scroll;
}
评论
webview