Search code examples
webviewreact-native

React native: webview height


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

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

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.


Solution

  • Apparently the problem was I had javaScriptEnabled={false}.

    After enabling it everything worked.