Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash] WebView inside ScrollView crash on scroll end - Android #2364

Closed
noumantahir opened this issue Feb 3, 2022 · 37 comments
Closed

[Crash] WebView inside ScrollView crash on scroll end - Android #2364

noumantahir opened this issue Feb 3, 2022 · 37 comments

Comments

@noumantahir
Copy link

noumantahir commented Feb 3, 2022

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:

Screen.Recording.2022-02-03.at.12.24.54.PM.mov

Environment:

  • OS: Android
  • OS version: 31
  • react-native version: 0.67.2
  • react-native-webview version: 11.17.1
@noumantahir noumantahir changed the title [Crash] WebView inside ScrollView c/ [Crash] WebView inside ScrollView crash on scroll end - Android Feb 3, 2022
@noumantahir
Copy link
Author

Update: added a simple example app to reproduce the bug... here is the repo link...
https://github.com/noumantahir/react-native-webview-scrollview-crash

@arthur-nesterenko
Copy link

+1
I have the same on android 12

@BeshoyEkram
Copy link

+1

@phuongwd
Copy link

phuongwd commented Feb 9, 2022

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

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

@noumantahir
Copy link
Author

@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...

@Kikketer
Copy link

+1

1 similar comment
@wxp686
Copy link

wxp686 commented Mar 16, 2022

+1

@rudyzeinoun
Copy link

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

@mokeev1995
Copy link

mokeev1995 commented May 4, 2022

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

@biaji
Copy link

biaji commented Jun 10, 2022

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 #1915

@VarniG
Copy link

VarniG commented Jul 27, 2022

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

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

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

@nuyozainal
Copy link

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

@rahulpunchh
Copy link

add in scrollView props

removeClippedSubviews={true}

work for me.

@MonchiLin
Copy link

add in scrollView props

removeClippedSubviews={true}

work for me.

Thank you, Magic Master. What happened here?

@phuongwd
Copy link

@swiersyoram
Copy link

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

@LunatiqueCoder
Copy link

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.

@donghuiqiu
Copy link

add in scrollView props

removeClippedSubviews={true}

work for me.

I add this prop in ScrollView cause full screen white

@DeepakSharma04
Copy link

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'}} />

@donghuiqiu
Copy link

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

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Feb 1, 2023
@PreetikaSingh
Copy link

still searching for solutions

@github-actions github-actions bot removed the Stale label Feb 7, 2023
@YesSkyscrapers
Copy link

YesSkyscrapers commented Feb 14, 2023

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

@andreialecu
Copy link

This is fixed by #2874.

You can use it via patch-package or similar until it's merged.

@susheelkumarazad
Copy link

@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...

@andreialecu
Copy link

Just a tip:

Depending on various factors, you will likely still experience crashes, albeit more rarely and randomly, with overScrollMode never. I suggest you use a crash monitoring solution to verify. The only real fix is the PR I mentioned in my previous comment.

@phuongwd
Copy link

Just a tip:

Depending on various factors, you will likely still experience crashes, albeit more rarely and randomly, with overScrollMode never. I suggest you use a crash monitoring solution to verify. The only real fix is the PR I mentioned in my previous comment.

@andreialecu thank you.

Do you mean then we can use default value overScrollMode: auto or always?

@andreialecu
Copy link

With the fix in that PR, yes.

@soumyapriyadarshi99
Copy link

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

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

Thanks for the reply. Working fine with this

@github-actions
Copy link

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label May 27, 2023
@Neelshah768
Copy link

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

@github-actions github-actions bot removed the Stale label Jun 1, 2023
@mrhung1999vnvn
Copy link

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

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

Save my life. Thanks so much

@adamsinnott
Copy link

We are currently using this PR in production. It works, seems stable and we'd really like to move back to the main package. Can anyone confirm what the delay in merging this PR is?

@github-actions
Copy link

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Sep 28, 2023
@mokeev1995
Copy link

mokeev1995 commented Sep 30, 2023

still searching for solutions

but we have one, but it's still not merged. #2874

Copy link

github-actions bot commented Dec 1, 2023

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Dec 1, 2023
@github-actions github-actions bot closed this as completed Dec 9, 2023
@taongocson
Copy link

taongocson commented Feb 1, 2024

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

https://reactnative.dev/docs/scrollview#overscrollmode-android
@noumantahir
i build debug ok
build release crash
Do you have any solution, ps help me!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests