mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add pointerEvents prop to RN Android scroll views
Summary: Per discussion in the previous diff D33672110, it's ok to add the `pointerEvents` prop to scrollview. This will help prevent scrolling on the ScrollView if pointerEvents is set to `box-none`, or `none`. Corresponding doc changes are in https://github.com/facebook/react-native-website/pull/2936 Changelog: [Android][Added] - Add new API in ScrollView and HorizontalScrollView to process pointerEvents prop. Reviewed By: javache Differential Revision: D33699223 fbshipit-source-id: 1cae5113e9e7d988fc4c4765c41d817a321804c4
This commit is contained in:
1 parent
d0f0234656
commit
48f6967ae8
5 files changed
+74
No files matched your search
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Possible values for pointer events that a view and its descendants should receive. See
|
||||
* https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info.
|
||||
@@ -25,4 +27,16 @@ public enum PointerEvents {
|
||||
/** Container and all of its children receive touch events (like pointerEvents is unspecified). */
|
||||
AUTO,
|
||||
;
|
||||
|
||||
public static PointerEvents parsePointerEvents(String pointerEventsStr) {
|
||||
return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_"));
|
||||
}
|
||||
|
||||
public static boolean canBeTouchTarget(PointerEvents pointerEvents) {
|
||||
return pointerEvents == AUTO || pointerEvents == PointerEvents.BOX_ONLY;
|
||||
}
|
||||
|
||||
public static boolean canChildrenBeTouchTarget(PointerEvents pointerEvents) {
|
||||
return pointerEvents == PointerEvents.AUTO || pointerEvents == PointerEvents.BOX_NONE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user