Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: lookup method only once #682

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: final adjustments
kirillzyusko committed Nov 13, 2024
commit fc050380b25a869b07e10263dece0380ede204d0
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ class JSPointerDispatcherCompat(
isCapture: Boolean,
) {
handleMotionEventMethod?.let { method ->
if (method.parameterCount == THREE_PARAMETERS) {
if (method.parameterCount == RN_72_PARAMS_COUNT) {
method.invoke(this, event, eventDispatcher, isCapture)
} else {
method.invoke(this, event, eventDispatcher)
@@ -51,6 +51,6 @@ class JSPointerDispatcherCompat(

companion object {
private const val HANDLE_MOTION_EVENT = "handleMotionEvent"
private const val THREE_PARAMETERS = 3
private const val RN_72_PARAMS_COUNT = 3
}
}
Original file line number Diff line number Diff line change
@@ -143,14 +143,14 @@ class OverKeyboardRootViewGroup(

override fun onInterceptHoverEvent(event: MotionEvent): Boolean {
eventDispatcher?.let {
jsPointerDispatcher?.handleMotionEventCompat(event, eventDispatcher, true)
jsPointerDispatcher?.handleMotionEventCompat(event, it, true)
}
return super.onHoverEvent(event)
}

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