0

I would like to know if it is possible to hide some part of a webView. For example, I'm using youtube and I would like to hide the search bar on top of the webView. Is this possible ?

I tried with putting a view with a height but it's not working..

Thanks for the help in advance.

Jats1596
  • 1,117
  • 1
  • 13
  • 20
  • You can try to inject js with `injectedJavaScript` prop and set style to `display=none`. Check [this](https://www.undefinednull.com/2015/12/27/injecting-custom-javascript-into-react-natives-webview/) – schogges Oct 08 '19 at 16:54
  • So if I want to hide the search bar, I will do : `document.querySelector('#header-bar').style.display = none` ? And then inject this in injectedJavascript ? – Jats1596 Oct 09 '19 at 07:47
  • How can I access to the youtube html code ? – Jats1596 Oct 09 '19 at 07:58
  • Open the url of your webview in browser and inspect the html to get the selector. – schogges Oct 09 '19 at 11:27
  • Yeah `#header-bar` is the selector, but when I try it doesn't work – Jats1596 Oct 09 '19 at 11:29
  • document.querySelector('#header-bar').style.display = 'none'. 'none' should be in commas – artsnr Jan 13 '21 at 11:06

0 Answers0