Skip to content

Commit 0bbd40f

Browse files
authored
[Android] Guard update events to only be dispatched in ACTIVE state (#4332)
## Description 1. Removes unused `isFirstEvent` 2. Adds a guard to ensure `update` events are only dispatched in `ACTIVE` state. I've noticed that `dispatchHandlerUpdate` was being called in state `END`. ## Test plan I didn't observe it in the runtime, only in the debugger while working on `Touchable` optimizations.
1 parent bbb49c3 commit 0bbd40f

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,8 @@ class GestureHandlerOrchestrator(
328328
}
329329

330330
if (!handler.isAwaiting || action != MotionEvent.ACTION_MOVE) {
331-
val isFirstEvent = handler.state == 0
332331
handler.handle(event, sourceEvent)
333-
if (handler.isActive) {
332+
if (handler.state == GestureHandler.STATE_ACTIVE && handler.isActive) {
334333
// After handler is done waiting for other one to fail its progress should be
335334
// reset, otherwise there may be a visible jump in values sent by the handler.
336335
// When handler is waiting it's already activated but the `isAwaiting` flag

0 commit comments

Comments
 (0)