Skip to content

Commit c51b969

Browse files
William Khoemeta-codesync[bot]
authored andcommitted
Changelog: [Android][Fixed] - Fixed bug where joystick could still scroll when scrollEnabled is false (#55458)
Summary: Pull Request resolved: #55458 Changelog: [Android][Fixed] - Fixed bug where joystick could still scroll when scrollEnabled is false Reviewed By: Abbondanzo Differential Revision: D92526659 fbshipit-source-id: fcdc7ef215d59de3c483ca201e6cee95865cfd56
1 parent 90adfc8 commit c51b969

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,11 @@ public boolean onTouchEvent(MotionEvent ev) {
843843

844844
@Override
845845
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
846+
// Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
847+
if (!mScrollEnabled) {
848+
return false;
849+
}
850+
846851
// We do not dispatch the motion event if its children are not supposed to receive it
847852
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
848853
return false;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<a79ecc0c8081ff170ad17a559095e1b1>>
7+
* @generated SignedSource<<78fb92f68ec0a93d0041ed381f76728e>>
88
*/
99

1010
/**
@@ -684,6 +684,11 @@ public boolean onTouchEvent(MotionEvent ev) {
684684

685685
@Override
686686
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
687+
// Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
688+
if (!mScrollEnabled) {
689+
return false;
690+
}
691+
687692
// We do not dispatch the motion event if its children are not supposed to receive it
688693
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
689694
return false;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ public boolean onTouchEvent(MotionEvent ev) {
676676

677677
@Override
678678
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
679+
// Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
680+
if (!mScrollEnabled) {
681+
return false;
682+
}
683+
679684
// We do not dispatch the motion event if its children are not supposed to receive it
680685
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
681686
return false;

0 commit comments

Comments
 (0)