Android - WebView renders incorrectly on large heights
See original GitHub issueBug description:
When rendering a WebView that is too long, it shows a massive padding on top of rendered content. The height at which this happends depends on the device/emulator.
For example, on a Pixel XL emulator, WebView behaves as expected up until height: 4500
. But once height is at around 5000 , it breaks.
To Reproduce:
import React from "react";
import { WebView } from "react-native-webview";
import { View } from "react-native";
const webViewContent = {
borderBottomColor: colors.paleGray,
borderBottomWidth: 1,
flex: 1,
flexDirection: "row",
opacity: 0.99,
paddingHorizontal: 0,
paddingVertical: 20,
margin: 0,
height: 5000, //4500 works
width: "100%"
},
const html = "This is a test".repeat(100)
export default Content = () => {
return (
<WebView
style={webViewContent}
source={ { html }}
/>
)
};
Expected behavior:
Webview renders HTML string filling the whole screen.
Screenshots/Videos:
Height set to 4500
Height set to 5000
Environment:
- OS: Android
- OS version: 9
- react-native version: 0.63.2
- react-native-webview version: 11.13.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
WebView doesn't shrink to fit the height of the page
I've been using a WebView to load different data (HTML data) and it's all working fine. But the problem comes when the WebView...
Read more >Slow rendering - Android Developers
If these are taking a long time, first check the width and height numbers in the trace. Ensure that the bitmap being displayed...
Read more >Android's WebView is broken - CleverTap
We render pure HTML and CSS inside Android's WebView, iOS' UIWebView, ... WebView rendered incorrectly in all versions of Android.
Read more >Android WebView ScrollTo is wrong when scroll offset is big.
I further investigated the issue and put some logs in cc/. The problem lies in LayerTreeImpl::GetDelegatedScrollOffset. The outer viewport ...
Read more >Tips for Getting Your Android Apps Looking Good on Amazon ...
You can think of the Amazon Fire TV screen as an Android device that is locked to landscape orientation, with a constant width...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i had the same issue while using “androidHardwareAccelerationDisabled={true}” removing that fixed the issue
@kirhammer
I got same problem when tried to render too long HTML. But adding additional props
androidLayerType="hardware"
works correctly for me.