File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2
2
import act from './act' ;
3
3
import { ErrorWithStack } from './helpers/errors' ;
4
4
5
+ const isTextInputComponent = ( element : ReactTestInstance ) => {
6
+ // eslint-disable-next-line import/no-extraneous-dependencies
7
+ const { TextInput } = require ( 'react-native' ) ;
8
+ return element . type === TextInput ;
9
+ } ;
10
+
5
11
const findEventHandler = (
6
12
element : ReactTestInstance ,
7
13
eventName : string ,
@@ -14,8 +20,11 @@ const findEventHandler = (
14
20
15
21
const isHostComponent = typeof element . type === 'string' ;
16
22
const hostElement = isHostComponent ? element : nearestHostDescendent ;
17
- const isEventEnabled =
18
- hostElement ?. props . onStartShouldSetResponder ?. ( ) !== false ;
23
+
24
+ const isEventEnabled = isTextInputComponent ( element )
25
+ ? element . props . editable !== false
26
+ : hostElement ?. props . onStartShouldSetResponder ?. ( ) !== false ;
27
+
19
28
if ( handler && isEventEnabled ) return handler ;
20
29
21
30
// Do not bubble event to the root element
You can’t perform that action at this time.
0 commit comments