react-native-webview icon indicating copy to clipboard operation
react-native-webview copied to clipboard

Scroll position of ScrollView jumps to WebView when pressed

Open vigneshrajs opened this issue 2 years ago • 21 comments

Bug description: When pressing a WebView inside a scrollable ScrollView, the scroll position jumps down to the WebView.

To Reproduce:

  • Install React Native version 0.71.3 and React Native webview Version 11.25.0
  • Place webview inside ScrollView.

The first time you press, it will jump down slightly.

Expected behavior: When clicking a WebView inside a ScrollView, it should not change the scroll position of the parent ScrollView.

Environment:

  • OS: Android
  • OS version: >11
  • react-native version: 0.71.3
  • react-native-webview version: 11.25.0

vigneshrajs avatar Jun 20 '23 05:06 vigneshrajs

Same issue here

knakandakare avatar Jun 20 '23 19:06 knakandakare

I have the same issue. It was also reported here: #2360 #2057 I also reported this issue in another repo ( here: https://github.com/iou90/react-native-autoheight-webview/issues/259 ) but it seems to be a problem with WebView

Bug description: Content jumps to top on first time press/click

To Reproduce:

To test on real device

  1. Open the screen
  2. Press the webview content

Source (static HTML or url): https://snack.expo.dev/@sanduluca/webview-content-jump-on-press

  1. Scan qr code and open app on a real android device
  2. Press any area below first white section To reproduce start from 1

Expected behavior: No jump when press webview content

Screenshots/Videos:

https://github.com/iou90/react-native-autoheight-webview/assets/56228534/6155f52b-e469-4eaf-a105-fe863665b3b5

Environment:

  • OS: Android
  • OS version: 12
  • react-native version: 0.71.7
  • react-native-webview version: ^12.0.2
  • react-native-autoheight-webview version: ^1.6.5

sanduluca avatar Jul 12 '23 10:07 sanduluca

It looks like the auto-scrolling is a behavior of the React Native ScrollView.

The only thing I imagine could be done from the react-native-webview side would be to set focusable to false... but I think that only makes sense if your WebView content is completely noninteractive? If that is your scenario, you could try hacking/patching in that change to see if it helps.

TheAlmightyBob avatar Jul 17 '23 00:07 TheAlmightyBob

It looks like the auto-scrolling is a behavior of the React Native ScrollView.

The only thing I imagine could be done from the react-native-webview side would be to set focusable to false... but I think that only makes sense if your WebView content is completely noninteractive? If that is your scenario, you could try hacking/patching in that change to see if it helps.

The focusable={false} on <WebView /> doesn't seem to help with content jump. Tried on the snack I provided above.

sanduluca avatar Jul 17 '23 05:07 sanduluca

focusable={false} on <WebView /> doesn't seem to help with content jump

I'm not sure the focusable property is actually hooked up (in fact I wonder if it's a mistake that WebViewSharedProps extends ViewProps...). I think this would require changing the native Android code.

TheAlmightyBob avatar Jul 17 '23 16:07 TheAlmightyBob

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[bot] avatar Sep 16 '23 00:09 github-actions[bot]

Sadly we are still searching for solutions

steffenkleinle avatar Sep 18 '23 05:09 steffenkleinle

same issue here

huanguolin avatar Sep 27 '23 02:09 huanguolin

Same issue here in IOS in version 13.6.2

sh-shamsan avatar Oct 18 '23 13:10 sh-shamsan

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[bot] avatar Dec 18 '23 00:12 github-actions[bot]

We are still looking for solutions

steffenkleinle avatar Dec 22 '23 12:12 steffenkleinle

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[bot] avatar Feb 21 '24 00:02 github-actions[bot]

We are sadly still experiencing this :/

steffenkleinle avatar Feb 22 '24 10:02 steffenkleinle

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[bot] avatar Apr 23 '24 00:04 github-actions[bot]

This sadly still happens :/

steffenkleinle avatar May 01 '24 11:05 steffenkleinle

This sadly still happen with me too :/

lvmtam avatar May 16 '24 04:05 lvmtam