Migrate ReactHitSlopView to kotlin

Summary:
Migrate ReactHitSlopView to kotlin

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D51262574

fbshipit-source-id: 7ad625bcdff1525299a0a9c9cf3409d081231b3c
This commit is contained in:
David Vacca
2023-11-15 09:43:03 -08:00
committed by Facebook GitHub Bot
parent 7f52791767
commit 803c5bb669
3 changed files with 19 additions and 27 deletions
@@ -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();
}
@@ -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?
}
@@ -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) {