Skip to content

Commit

Permalink
fix: ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
gronxb committed Nov 12, 2024
1 parent 4df85e6 commit 407438d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@

package com.reactnativekeyboardcontroller.views.overlay

import android.view.MotionEvent
import android.view.ViewGroup

import com.facebook.react.uimanager.JSPointerDispatcher
import com.facebook.react.uimanager.events.EventDispatcher

/**
* Compat layer for `JSPointerDispatcher` interface for RN < 0.72
*/
class JSPointerDispatcherCompat(private val viewGroup: ViewGroup) : JSPointerDispatcher(viewGroup) {
fun handleMotionEventCompat(event: MotionEvent?, eventDispatcher: EventDispatcher?, isCapture: Boolean) {
val method = try {
JSPointerDispatcher::class.java.getMethod("handleMotionEvent", MotionEvent::class.java, EventDispatcher::class.java, Boolean::class.javaPrimitiveType)
} catch (e: NoSuchMethodException) {
JSPointerDispatcher::class.java.getMethod("handleMotionEvent", MotionEvent::class.java, EventDispatcher::class.java)
}
class JSPointerDispatcherCompat(
private val viewGroup: ViewGroup,
) : JSPointerDispatcher(viewGroup) {
fun handleMotionEventCompat(
event: MotionEvent?,
eventDispatcher: EventDispatcher?,
isCapture: Boolean,
) {
val method =
try {
JSPointerDispatcher::class.java.getMethod(
"handleMotionEvent",
MotionEvent::class.java,
EventDispatcher::class.java,
Boolean::class.javaPrimitiveType,
)
} catch (e: NoSuchMethodException) {
JSPointerDispatcher::class.java.getMethod(
"handleMotionEvent",
MotionEvent::class.java,
EventDispatcher::class.java,
)
}
method.invoke(this, event, eventDispatcher, isCapture)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class OverKeyboardRootViewGroup(
}

override fun onHoverEvent(event: MotionEvent): Boolean {
eventDispatcher?.let {
eventDispatcher?.let {
jsPointerDispatcher?.handleMotionEventCompat(event, eventDispatcher, false)
}
return super.onHoverEvent(event)
Expand Down

0 comments on commit 407438d

Please sign in to comment.