Skip to content

Commit c23cc18

Browse files
committed
Touchable ts errors
1 parent dac49b0 commit c23cc18

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

packages/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface InternalProps {
3333

3434
// TODO: maybe can be better
3535
// TODO: all clearTimeout have ! added, maybe they shouldn't ?
36-
type Timeout = ReturnType<typeof setTimeout> | null | undefined;
36+
type Timeout = ReturnType<typeof setTimeout> | undefined;
3737

3838
/**
3939
* GenericTouchable is not intented to be used as it is.
@@ -70,7 +70,7 @@ export default class GenericTouchable extends Component<
7070
if (this.props.delayPressIn) {
7171
this.pressInTimeout = setTimeout(() => {
7272
this.moveToState(TOUCHABLE_STATE.BEGAN);
73-
this.pressInTimeout = null;
73+
this.pressInTimeout = undefined;
7474
}, this.props.delayPressIn);
7575
} else {
7676
this.moveToState(TOUCHABLE_STATE.BEGAN);
@@ -89,7 +89,7 @@ export default class GenericTouchable extends Component<
8989
this.pressOutTimeout ||
9090
setTimeout(() => {
9191
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
92-
this.pressOutTimeout = null;
92+
this.pressOutTimeout = undefined;
9393
}, this.props.delayPressOut);
9494
} else {
9595
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
@@ -105,7 +105,7 @@ export default class GenericTouchable extends Component<
105105
this.moveToState(TOUCHABLE_STATE.BEGAN);
106106
}
107107
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
108-
this.pressOutTimeout = null;
108+
this.pressOutTimeout = undefined;
109109
}, this.props.delayPressOut);
110110
} else {
111111
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
@@ -125,9 +125,9 @@ export default class GenericTouchable extends Component<
125125
clearTimeout(this.pressInTimeout);
126126
clearTimeout(this.pressOutTimeout);
127127
clearTimeout(this.longPressTimeout);
128-
this.pressOutTimeout = null;
129-
this.longPressTimeout = null;
130-
this.pressInTimeout = null;
128+
this.pressOutTimeout = undefined;
129+
this.longPressTimeout = undefined;
130+
this.pressInTimeout = undefined;
131131
}
132132

133133
// All states' transitions are defined here.
@@ -189,7 +189,7 @@ export default class GenericTouchable extends Component<
189189
const shouldCallOnPress =
190190
!this.longPressDetected &&
191191
this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE &&
192-
this.pressOutTimeout === null;
192+
this.pressOutTimeout === undefined;
193193
this.handleGoToUndetermined();
194194
if (shouldCallOnPress) {
195195
// Calls only inside component whether no long press was called previously
@@ -219,7 +219,7 @@ export default class GenericTouchable extends Component<
219219
onMoveOut() {
220220
// Long press should no longer be detected
221221
clearTimeout(this.longPressTimeout);
222-
this.longPressTimeout = null;
222+
this.longPressTimeout = undefined;
223223
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
224224
this.handleMoveOutside();
225225
}

0 commit comments

Comments
 (0)