反应原生:webview 高度 [英] React native: webview height

查看:37
本文介绍了反应原生:webview 高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个关于 react native 中 webview 自动高度的已知问题,我已经尝试了我在互联网上找到的所有可能的解决方案,例如:

Hi I know it's a known issue about the auto height of webview in react native, and I have tried all the possibles solutions I've found on the internet such as :

https://gist.github.com/epeli/10c77c1710dd137a1335

https://github.com/danrigsby/react-native-web-container/blob/master/index.js

以及以下建议的所有解决方案:React Native:是否可以在 webview 中设置 html 内容的高度?

and all the solutions suggested in: React native: Is it possible to have the height of a html content in a webview?

但不幸的是,这些似乎都不适合我,我知道他们都建议的解决方法是将标题设置为高度,但就我而言,标题似乎始终保持不变,即:text/html ...."和我的 html 的其余部分.我从 API 获取 html 内容,它没有 body、head 或 html 标签,我也尝试将这些标签手动添加到 html 中,但似乎没有任何效果.

But unfortunately none of these seems to work for me, I understand that the workaround they all suggest is to set the title to the height, but in my case it seems that the title always stays the same which is : "text/html ...." and the rest of my html. I get the html content from an API, it comes without a body, head or html tags, I've also tried adding these tags manually to the html and nothing seems to work.

我很想知道是否有人遇到过这个问题以及它是如何解决的.

I would love to hear if anyone else had that problem and how did it get fixed.

推荐答案

显然问题是我有 javaScriptEnabled={false}.

启用后一切正常.

这篇关于反应原生:webview 高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆