1

My app has a WebView and works fine in Android and iOS, although in some cases the following Facebook pop up asking for cookies is shown and it's not possible to scroll down. Then the whole web view is not usable.

enter image description here

The code is very simple:

<WebView
  source={{
    uri: url
  }}/>

How could I make it scrollable as well? Thanks!

2
  • Is it happening with the Facebook URL or nothing is scrollable in webview? Commented Dec 19, 2020 at 12:31
  • @ShahnawazHossan With my Android and iOS simulator is all good even if the pop up appears because it fits completely in the screen. When I try with my mobile phone the pop up appears but too big and it needs to scroll, but I can't. I would like to make it always scrollable
    – Federico
    Commented Dec 19, 2020 at 12:44

2 Answers 2

0

A possible solution could be to include the webview inside a ScrollView

<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
  <WebView
    source={{
      uri: url
    }}/>
</ScrollView>

Other possible solution could be using:

https://github.com/iou90/react-native-autoheight-webview#readme

Note: if the webview is already included in a ScrollView check if setting some bottomPadding or some contentInset makes the modal scrollable till the end.

0

The resolution is too small to show the entire popup.

You can either zoom out with something like:

webview.setInitialScale(1);
webview.getSettings().setLoadWithOverviewMode(true); 
webview.getSettings().setUseWideViewPort(true);

Or you can edit the web page itself to scale down using the page's viewport meta, shrink the popup with CSS, or add a scrollbar to that specific element by setting the css of the element to:

#target{
max-height:100%;
overflow:scroll;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.