diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java deleted file mode 100644 index 8231a335a7b..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.touch; - -import android.graphics.Rect; -import androidx.annotation.Nullable; - -/** - * This interface should be implemented by all {@link View} subclasses that want to use the hitSlop - * prop to extend their touch areas. - */ -public interface ReactHitSlopView { - - /** - * Called when determining the touch area of a view. - * - * @return A {@link Rect} representing how far to extend the touch area in each direction. - */ - @Nullable - Rect getHitSlopRect(); -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.kt new file mode 100644 index 00000000000..469fa35a609 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.kt @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.touch + +import android.graphics.Rect + +/** + * This interface should be implemented by all [View] subclasses that want to use the hitSlop prop + * to extend their touch areas. + */ +interface ReactHitSlopView { + val hitSlopRect: Rect? +} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt index 7447e45313a..ef65868eca5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt @@ -413,7 +413,7 @@ object ReactMapBufferPropSetter { PixelUtil.toPixelFromDIP(value.getDouble(EDGE_RIGHT)).toInt(), PixelUtil.toPixelFromDIP(value.getDouble(EDGE_BOTTOM)).toInt(), ) - hitSlopRect = rect + setHitSlopRect(rect) } private fun ReactViewGroup.importantForAccessibility(value: Int) {