@@ -40,20 +40,28 @@ function isPointerEventEnabled(
40
40
return isPointerEventEnabled ( parent , true ) ;
41
41
}
42
42
43
- // Due to accepting both `press` and `onPress` for event names, we need to
44
- // cover both forms.
45
- const touchEventNames = [ 'press' , 'onPress' ] ;
46
-
47
- function isTouchEvent ( eventName : string ) {
48
- return touchEventNames . includes ( eventName ) ;
49
- }
50
-
51
- // Experimentally checked which events are called on non-editable TextInput
52
- const textInputEventsIgnoringEditableProp = [
43
+ /**
44
+ * List of events affected by `pointerEvents` prop.
45
+ *
46
+ * Note: `fireEvent` is accepting both `press` and `onPress` for event names,
47
+ * so we need cover both forms.
48
+ */
49
+ const eventsAffectedByPointerEventsProp = new Set ( [ 'press' , 'onPress' ] ) ;
50
+
51
+ /**
52
+ * List of `TextInput` events not affected by `editable` prop.
53
+ *
54
+ * Note: `fireEvent` is accepting both `press` and `onPress` for event names,
55
+ * so we need cover both forms.
56
+ */
57
+ const textInputEventsIgnoringEditableProp = new Set ( [
53
58
'contentSizeChange' ,
59
+ 'onContentSizeChange' ,
54
60
'layout' ,
61
+ 'onLayout' ,
55
62
'scroll' ,
56
- ] ;
63
+ 'onScroll' ,
64
+ ] ) ;
57
65
58
66
function isEventEnabled (
59
67
element : ReactTestInstance ,
@@ -63,11 +71,14 @@ function isEventEnabled(
63
71
if ( isHostTextInput ( nearestTouchResponder ) ) {
64
72
return (
65
73
nearestTouchResponder ?. props . editable !== false ||
66
- textInputEventsIgnoringEditableProp . includes ( eventName )
74
+ textInputEventsIgnoringEditableProp . has ( eventName )
67
75
) ;
68
76
}
69
77
70
- if ( isTouchEvent ( eventName ) && ! isPointerEventEnabled ( element ) ) {
78
+ if (
79
+ eventsAffectedByPointerEventsProp . has ( eventName ) &&
80
+ ! isPointerEventEnabled ( element )
81
+ ) {
71
82
return false ;
72
83
}
73
84
0 commit comments