Skip to content

Commit 79fd398

Browse files
committed
refactor: improve null checks
1 parent 65dc20e commit 79fd398

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/fireEvent.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getHostComponentNames } from './helpers/host-component-names';
77

88
type EventHandler = (...args: any) => unknown;
99

10-
function isTextInput(element?: ReactTestInstance) {
10+
function isTextInput(element: ReactTestInstance) {
1111
if (!element) {
1212
return false;
1313
}
@@ -22,10 +22,12 @@ function isTextInput(element?: ReactTestInstance) {
2222
);
2323
}
2424

25-
function isTouchResponder(element?: ReactTestInstance) {
26-
if (!isHostElement(element)) return false;
25+
function isTouchResponder(element: ReactTestInstance) {
26+
if (!isHostElement(element)) {
27+
return false;
28+
}
2729

28-
return !!element?.props.onStartShouldSetResponder || isTextInput(element);
30+
return !!element.props.onStartShouldSetResponder || isTextInput(element);
2931
}
3032

3133
function isPointerEventEnabled(

0 commit comments

Comments
 (0)