react-native-webview: [Crash] WebView inside ScrollView crash on scroll end - Android

Bug description: When I try to put a webview inside a scroll view along with other native content, the app crashes when scroll reaches the end. I have tried various different possibilities to check if it has something to do with my code but it seems otherwise.

Things work fine on iOS side, only Android side crashes.

To Reproduce: Even a simple code as this one below should reproduce the bug, it does on my side.

const dummyString = `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).


Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.`

const html = '<p>This is web body</p>'
return (      
  <ScrollView>
          <WebView style={{height:200}} scrollEnabled={false} source={{html}} ></WebView>
          <Text>{dummyString}</Text>
  </ScrollView>
);

Example app with reproduction code: https://github.com/noumantahir/react-native-webview-scrollview-crash

Screenshots/Videos:

https://user-images.githubusercontent.com/6298342/152299012-d684fbe6-3f45-4e60-96ff-2a86cf0c7c5a.mov

Environment:

  • OS: Android
  • OS version: 31
  • react-native version: 0.67.2
  • react-native-webview version: 11.17.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 37

Most upvoted comments

add in scrollView props

removeClippedSubviews={true}

work for me.

@noumantahir Did you try to add overScrollMode="never" ?

https://reactnative.dev/docs/scrollview#overscrollmode-android

Thanks for the tip @phuongwd this worked like a charmm, saved us so much frustration…

+1 I have the same on android 12

Silly me, I was adding overScrollMode="never" to the WebView, but instead it should be for ScrollView of course. Thank you! Works like a charm.

Same problem, but, even with the tip above applied, crash persists if you navigate back (@react-navigation/stack). Need a proper solution for this issue.

OS: Android (OneUI 4.1)
OS version: 12 (API level: 31)
react-native version: 0.68.1
react-native-webview version: 11.18.1

I think this issue is connected with #1915 and #429

Hi , I am also facing same Issue ,please help…!! It’s works Fine In IOS But In android when we scroll to the end App crash ,I try to used androidLayerType=‘software’ but it’s show blank white screen.

<RenderHtml contentWidth={width - 25} source={{ html: item.body }} enableExperimentalMarginCollapsing={true} enableExperimentalBRCollapsing={true} customHTMLElementModels={customHTMLElementModels} WebView={WebView} renderers={renderers} defaultWebViewProps={{ overScrollMode: 'never'}} />

remove removeClippedSubviews={true} prop in ScrollView and remove opacity={{0.99}} prop in WebView , just add overScrollMode=‘never’ in ScrollView works for me

@noumantahir Did you try to add overScrollMode="never" ?

https://reactnative.dev/docs/scrollview#overscrollmode-android

You are a genius. You solved my 9hours problem.

Using removeClippedSubviews={true} and overScrollMode="never" together worked for me! Thanks a lot guys!

Same problem here and the tip by @phuongwd works great.

This is because of the over scrolled occur in react native try to use this:- overScrollMode=“never”

renderToHardwareTextureAndroid={true} if u set it to webview parent (for its View), so crash will not reproduce

i’m using import { WebView } from ‘react-native-webview’, implementing opacity:0.99 doesn’t work for me until i change to import { WebView } from ‘react-native’ and add opacity:0.99

With the fix in that PR, yes.

@noumantahir Did you try to add overScrollMode="never" ? https://reactnative.dev/docs/scrollview#overscrollmode-android

Thanks for the tip @phuongwd this worked like a charmm, saved us so much frustration…

Same problem, and overScrollMode doesn’t work. Still trying to dig out. My crash result in a hwui native crash like:

06-07 10:05:07.656 10614 10614 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-07 10:05:07.656 10614 10614 F DEBUG   : Build fingerprint: 'Xiaomi/zeus/zeus:12/SKQ1.211006.001/V13.0.10.0.SLBCNXM:user/release-keys'
06-07 10:05:07.656 10614 10614 F DEBUG   : Revision: '0'
06-07 10:05:07.656 10614 10614 F DEBUG   : ABI: 'arm'
06-07 10:05:07.656 10614 10614 F DEBUG   : Timestamp: 2022-06-07 10:05:06.787993549+0800
06-07 10:05:07.656 10614 10614 F DEBUG   : Process uptime: 0s
06-07 10:05:07.656 10614 10614 F DEBUG   : Cmdline: xxxxxxx
06-07 10:05:07.656 10614 10614 F DEBUG   : pid: 8114, tid: 8322, name: RenderThread  >>> xxxxx <<<
06-07 10:05:07.656 10614 10614 F DEBUG   : uid: 10260
06-07 10:05:07.657 10614 10614 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1c
06-07 10:05:07.657 10614 10614 F DEBUG   : Cause: null pointer dereference
06-07 10:05:07.657 10614 10614 F DEBUG   :     r0  00000000  r1  000000d6  r2  00000000  r3  00000004
06-07 10:05:07.657 10614 10614 F DEBUG   :     r4  00000000  r5  00000000  r6  00000002  r7  ee1c0e70
06-07 10:05:07.657 10614 10614 F DEBUG   :     r8  b6ada7f0  r9  e91d1138  r10 ee349010  r11 9de8fc90
06-07 10:05:07.657 10614 10614 F DEBUG   :     ip  b6ada7c8  sp  b6ada720  lr  ed746175  pc  ed691410
06-07 10:05:07.657 10614 10614 F DEBUG   : backtrace:
06-07 10:05:07.657 10614 10614 F DEBUG   :       #00 pc 00262410  /system/lib/libhwui.so (SkSurface::getCanvas()+4) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #01 pc 00317171  /system/lib/libhwui.so (android::uirenderer::skiapipeline::GLFunctorDrawable::onDraw(SkCanvas*)+512) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #02 pc 002f30d1  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+50) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #03 pc 004828f1  /system/lib/libhwui.so (SkGpuDevice::drawDrawable(SkDrawable*, SkMatrix const*, SkCanvas*)+248) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #04 pc 002fd49b  /system/lib/libhwui.so (android::uirenderer::$_36::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.107763203406184330)+90) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #05 pc 00196453  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3522) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #06 pc 001955a5  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+240) (BuildId: bd53c7848ef794c4d84b32e937f0993b)
06-07 10:05:07.657 10614 10614 F DEBUG   :       #07 pc 00126597  /system/lib/libhwui.so (android::uirenderer::$_23::__invoke(void const*, SkCanvas*, SkMatrix const&) (.llvm.107763203406184330)+50) (BuildId: bd53c7848ef794c4d84b32e937f0993b)

It’s only happened on Android 12 with Qualcomm Gen 1


ok, I finally realized it’s dup to https://github.com/react-native-webview/react-native-webview/issues/1915