From c23cc18ed9f8a91a152e9db965d5d7422fdc6d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 9 Apr 2026 08:36:02 +0200 Subject: [PATCH 1/2] Touchable ts errors --- .../components/touchables/GenericTouchable.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx b/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx index 5e43b8c07f..c608ddbbf4 100644 --- a/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx +++ b/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx @@ -33,7 +33,7 @@ interface InternalProps { // TODO: maybe can be better // TODO: all clearTimeout have ! added, maybe they shouldn't ? -type Timeout = ReturnType | null | undefined; +type Timeout = ReturnType | undefined; /** * GenericTouchable is not intented to be used as it is. @@ -70,7 +70,7 @@ export default class GenericTouchable extends Component< if (this.props.delayPressIn) { this.pressInTimeout = setTimeout(() => { this.moveToState(TOUCHABLE_STATE.BEGAN); - this.pressInTimeout = null; + this.pressInTimeout = undefined; }, this.props.delayPressIn); } else { this.moveToState(TOUCHABLE_STATE.BEGAN); @@ -89,7 +89,7 @@ export default class GenericTouchable extends Component< this.pressOutTimeout || setTimeout(() => { this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE); - this.pressOutTimeout = null; + this.pressOutTimeout = undefined; }, this.props.delayPressOut); } else { this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE); @@ -105,7 +105,7 @@ export default class GenericTouchable extends Component< this.moveToState(TOUCHABLE_STATE.BEGAN); } this.moveToState(TOUCHABLE_STATE.UNDETERMINED); - this.pressOutTimeout = null; + this.pressOutTimeout = undefined; }, this.props.delayPressOut); } else { if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) { @@ -125,9 +125,9 @@ export default class GenericTouchable extends Component< clearTimeout(this.pressInTimeout); clearTimeout(this.pressOutTimeout); clearTimeout(this.longPressTimeout); - this.pressOutTimeout = null; - this.longPressTimeout = null; - this.pressInTimeout = null; + this.pressOutTimeout = undefined; + this.longPressTimeout = undefined; + this.pressInTimeout = undefined; } // All states' transitions are defined here. @@ -189,7 +189,7 @@ export default class GenericTouchable extends Component< const shouldCallOnPress = !this.longPressDetected && this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE && - this.pressOutTimeout === null; + this.pressOutTimeout === undefined; this.handleGoToUndetermined(); if (shouldCallOnPress) { // Calls only inside component whether no long press was called previously @@ -219,7 +219,7 @@ export default class GenericTouchable extends Component< onMoveOut() { // Long press should no longer be detected clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; + this.longPressTimeout = undefined; if (this.STATE === TOUCHABLE_STATE.BEGAN) { this.handleMoveOutside(); } From 9b343ebc6be27e75e4a254d5b68fc6e1d6336208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 9 Apr 2026 08:41:39 +0200 Subject: [PATCH 2/2] Remove todo --- .../src/components/touchables/GenericTouchable.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx b/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx index c608ddbbf4..74e07b7933 100644 --- a/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx +++ b/packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx @@ -31,8 +31,6 @@ interface InternalProps { onStateChange?: (oldState: TouchableState, newState: TouchableState) => void; } -// TODO: maybe can be better -// TODO: all clearTimeout have ! added, maybe they shouldn't ? type Timeout = ReturnType | undefined; /**