Skip to content

Commit e193ff4

Browse files
committed
throwing when propsref is null
1 parent de98017 commit e193ff4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/react-native-gesture-handler/src/web/handlers/GestureHandler.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,14 @@ export default abstract class GestureHandler implements IGestureHandler {
352352
}
353353

354354
public sendTouchEvent(event: AdaptedEvent): void {
355-
if (!this.enabled || !this.propsRef) {
355+
if (!this.enabled) {
356356
return;
357357
}
358-
358+
if (!this.propsRef) {
359+
throw new Error(
360+
tagMessage('Cannot handle event when component props are null')
361+
);
362+
}
359363
const { onGestureHandlerEvent, onGestureHandlerTouchEvent }: PropsRef =
360364
this.propsRef.current;
361365

@@ -380,7 +384,9 @@ export default abstract class GestureHandler implements IGestureHandler {
380384

381385
public sendEvent = (newState: State, oldState: State): void => {
382386
if (!this.propsRef) {
383-
return;
387+
throw new Error(
388+
tagMessage('Cannot handle event when component props are null')
389+
);
384390
}
385391
const {
386392
onGestureHandlerEvent,
@@ -536,7 +542,9 @@ export default abstract class GestureHandler implements IGestureHandler {
536542

537543
private cancelTouches(): void {
538544
if (!this.propsRef) {
539-
return;
545+
throw new Error(
546+
tagMessage('Cannot handle event when component props are null')
547+
);
540548
}
541549
const rect = this.delegate.measureView();
542550

0 commit comments

Comments
 (0)