0
<NaiveAutoheightWebView
            key={`webview-${i}`}
            androidHardwareAccelerationDisabled
            overScrollMode="never"
            androidLayerType={'none'}
            javaScriptEnabled={true}
            scrollEnabled={false}
            bounces={false}
            javaScriptEnabledAndroid={true}
            allowsFullscreenVideo={false}
            ignoreSslError={true}
            source={{ html: seperateHtml(parts[i]) }}
            scalesPageToFit={true}
            onMessage={onWebViewMessage}
            contentInsetAdjustmentBehavior="automatic"
            injectedJavaScript={`
                            document.body.style.userSelect = 'none';
                            window.ReactNativeWebView.postMessage(Math.max(document.body.offsetHeight, document.body.scrollHeight));
                            `}
            startInLoadingState={true}
            onLoad={() => {
              setLoadingWebview(false);
            }}
            onLoadEnd={() => {
              setLoadingWebview(false);
            }}
            onError={() => {
              setLoadingWebview(false);
            }}
            parentMsid={htmlBody?.msid}
          />

While scrolling slowly on android/ios, it suddenly scrolls the page up and every time have to find last read line.

3
  • From what I can tell, NativeAutoHeightWebView doesnt do much and it uses an older version of github.com/react-native-webview/react-native-webview. Have you tried using a newer WebView version? Commented Jan 29 at 21:07
  • I'm looking at NativeAutoHeightWebView here and I think this library is either redundant, or was created at a time where WebView did not support these features; but I am certain that as of now, that the webview content is properly scaled to the width and height provided in the WebView style prop Commented Jan 29 at 21:13
  • Yes, I have tried using WebView as well, but I am facing the same issue. Additionally, in WebView, we need to explicitly define the height; otherwise, it only displays the minimum content. Commented Jan 30 at 7:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.