MCPcopy
hub / github.com/callstack/react-native-testing-library / isEventEnabled

Function isEventEnabled

src/fire-event.ts:48–71  ·  view source on GitHub ↗
(
  instance: TestInstance,
  eventName: string,
  nearestTouchResponder?: TestInstance,
)

Source from the content-addressed store, hash-verified

46]);
47
48function isEventEnabled(
49 instance: TestInstance,
50 eventName: string,
51 nearestTouchResponder?: TestInstance,
52) {
53 if (nearestTouchResponder != null && isHostTextInput(nearestTouchResponder)) {
54 return (
55 isEditableTextInput(nearestTouchResponder) ||
56 textInputEventsIgnoringEditableProp.has(eventName)
57 );
58 }
59
60 if (eventsAffectedByPointerEventsProp.has(eventName) && !isPointerEventEnabled(instance)) {
61 return false;
62 }
63
64 const touchStart = nearestTouchResponder?.props.onStartShouldSetResponder?.();
65 const touchMove = nearestTouchResponder?.props.onMoveShouldSetResponder?.();
66 if (touchStart || touchMove) {
67 return true;
68 }
69
70 return touchStart === undefined && touchMove === undefined;
71}
72
73function findEventHandler(
74 instance: TestInstance,

Callers 1

findEventHandlerFunction · 0.85

Calls 3

isHostTextInputFunction · 0.90
isEditableTextInputFunction · 0.90
isPointerEventEnabledFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…