-
public class TouchTargetHelper
Class responsible for identifying which react view should handle a given MotionEvent. It uses the event coordinates to traverse the view hierarchy and return a suitable view.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
TouchTargetHelper.ViewTarget
-
Method Summary
Modifier and Type Method Description static int
findTargetTagForTouch(float eventX, float eventY, ViewGroup viewGroup)
Find touch event target view within the provided container given the coordinates provided via MotionEvent. static int
findTargetTagForTouch(float eventX, float eventY, ViewGroup viewGroup, @Nullable() Array<int> nativeViewId)
Find touch event target view within the provided container given the coordinates provided via MotionEvent. static int
findTargetTagAndCoordinatesForTouch(float eventX, float eventY, ViewGroup viewGroup, Array<float> viewCoords, @Nullable() Array<int> nativeViewTag)
Find touch event target view within the provided container given the coordinates provided via MotionEvent. static List<TouchTargetHelper.ViewTarget>
findTargetPathAndCoordinatesForTouch(float eventX, float eventY, ViewGroup viewGroup, Array<float> viewCoords)
Find touch event target view within the provided container given the coordinates provided via MotionEvent. -
-
Method Detail
-
findTargetTagForTouch
static int findTargetTagForTouch(float eventX, float eventY, ViewGroup viewGroup)
Find touch event target view within the provided container given the coordinates provided via MotionEvent.
- Parameters:
eventX
- the X screen coordinate of the touch locationeventY
- the Y screen coordinate of the touch locationviewGroup
- the container view to traverse
-
findTargetTagForTouch
static int findTargetTagForTouch(float eventX, float eventY, ViewGroup viewGroup, @Nullable() Array<int> nativeViewId)
Find touch event target view within the provided container given the coordinates provided via MotionEvent.
- Parameters:
eventX
- the X screen coordinate of the touch locationeventY
- the Y screen coordinate of the touch locationviewGroup
- the container view to traversenativeViewId
- the native react view containing this touch target
-
findTargetTagAndCoordinatesForTouch
static int findTargetTagAndCoordinatesForTouch(float eventX, float eventY, ViewGroup viewGroup, Array<float> viewCoords, @Nullable() Array<int> nativeViewTag)
Find touch event target view within the provided container given the coordinates provided via MotionEvent.
- Parameters:
eventX
- the X screen coordinate of the touch locationeventY
- the Y screen coordinate of the touch locationviewGroup
- the container view to traverseviewCoords
- an out parameter that will return the X,Y value in the target viewnativeViewTag
- an out parameter that will return the native view id
-
findTargetPathAndCoordinatesForTouch
static List<TouchTargetHelper.ViewTarget> findTargetPathAndCoordinatesForTouch(float eventX, float eventY, ViewGroup viewGroup, Array<float> viewCoords)
Find touch event target view within the provided container given the coordinates provided via MotionEvent.
- Parameters:
eventX
- the X screen coordinate of the touch locationeventY
- the Y screen coordinate of the touch locationviewGroup
- the container view to traverseviewCoords
- an out parameter that will return the X,Y value in the target view
-
-
-
-