@@ -40,20 +40,28 @@ function isPointerEventEnabled(
4040  return  isPointerEventEnabled ( parent ,  true ) ; 
4141} 
4242
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 ( [ 
5358  'contentSizeChange' , 
59+   'onContentSizeChange' , 
5460  'layout' , 
61+   'onLayout' , 
5562  'scroll' , 
56- ] ; 
63+   'onScroll' , 
64+ ] ) ; 
5765
5866function  isEventEnabled ( 
5967  element : ReactTestInstance , 
@@ -63,11 +71,14 @@ function isEventEnabled(
6371  if  ( isHostTextInput ( nearestTouchResponder ) )  { 
6472    return  ( 
6573      nearestTouchResponder ?. props . editable  !==  false  || 
66-       textInputEventsIgnoringEditableProp . includes ( eventName ) 
74+       textInputEventsIgnoringEditableProp . has ( eventName ) 
6775    ) ; 
6876  } 
6977
70-   if  ( isTouchEvent ( eventName )  &&  ! isPointerEventEnabled ( element ) )  { 
78+   if  ( 
79+     eventsAffectedByPointerEventsProp . has ( eventName )  && 
80+     ! isPointerEventEnabled ( element ) 
81+   )  { 
7182    return  false ; 
7283  } 
7384
0 commit comments