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

Function fireEvent

src/fire-event.ts:128–146  ·  view source on GitHub ↗
(instance: TestInstance, eventName: EventName, ...data: unknown[])

Source from the content-addressed store, hash-verified

126>;
127
128async function fireEvent(instance: TestInstance, eventName: EventName, ...data: unknown[]) {
129 if (!isInstanceMounted(instance)) {
130 return;
131 }
132
133 setNativeStateIfNeeded(instance, eventName, data[0]);
134
135 const handler = findEventHandler(instance, eventName);
136 if (!handler) {
137 return;
138 }
139
140 let returnValue;
141 await act(() => {
142 returnValue = handler(...data);
143 });
144
145 return returnValue;
146}
147
148type EventProps = Record<string, unknown>;
149

Callers 4

input.tsxFile · 0.85
expected.tsxFile · 0.85
fire-event.tsFile · 0.85

Calls 4

isInstanceMountedFunction · 0.90
actFunction · 0.90
setNativeStateIfNeededFunction · 0.85
findEventHandlerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…