Skip to content

Commit 67292e1

Browse files
committed
Remove comments
1 parent fb2d4fa commit 67292e1

3 files changed

Lines changed: 2 additions & 15 deletions

File tree

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ class RNGestureHandlerTouchEvent private constructor() : Event<RNGestureHandlerT
6969
putInt("eventType", handler.touchEventType)
7070
putInt("pointerType", handler.pointerType)
7171

72-
// Both keys have to be present in every touch event, otherwise the JS side may
73-
// misclassify it as an update event and crash trying to read gesture-specific data.
74-
// The payloads may be null when the tracked pointers were cleared before the event
75-
// was serialized (e.g. the gesture was cancelled by a rapid succession of taps) or
76-
// when the payload was already consumed - fall back to empty arrays, matching iOS.
7772
putArray("changedTouches", handler.consumeChangedTouchesPayload() ?: Arguments.createArray())
78-
7973
putArray("allTouches", handler.consumeAllTouchesPayload() ?: Arguments.createArray())
8074

8175
if (handler.isAwaiting && handler.state == GestureHandler.STATE_ACTIVE) {

packages/react-native-gesture-handler/src/v3/hooks/callbacks/eventHandler.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ export function eventHandler<
150150
return;
151151
}
152152

153-
// At this point the event should be an update event carrying `handlerData`.
154-
// If it isn't, it's a malformed event (e.g. a touch event that lost its
155-
// `allTouches` payload in a race on the native side) - drop it instead of
156-
// running the change calculator on undefined data, which would crash the UI
157-
// thread.
153+
// Guard against malformed events
158154
if (eventWithData.handlerData === undefined) {
159155
return;
160156
}

packages/react-native-gesture-handler/src/v3/hooks/utils/eventUtils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ export function getChangeEventCalculator<TExtendedHandlerData>(
119119
'worklet';
120120
const currentEventData = current.handlerData;
121121

122-
// Events missing `handlerData` cannot have their change payload computed.
123-
// This shouldn't happen for well-formed update events, but a malformed
124-
// event (e.g. a touch event that lost its payloads in a race on the native
125-
// side) must not crash the diff calculator on the UI thread.
122+
// Guard against malformed events
126123
if (currentEventData === undefined) {
127124
return current;
128125
}

0 commit comments

Comments
 (0)