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

Function setNativeStateIfNeeded

src/fire-event.ts:181–192  ·  view source on GitHub ↗
(instance: TestInstance, eventName: string, value: unknown)

Source from the content-addressed store, hash-verified

179]);
180
181function setNativeStateIfNeeded(instance: TestInstance, eventName: string, value: unknown) {
182 if (eventName === 'changeText' && typeof value === 'string' && isEditableTextInput(instance)) {
183 nativeState.valueForInstance.set(instance, value);
184 }
185
186 if (scrollEventNames.has(eventName) && isHostScrollView(instance)) {
187 const contentOffset = tryGetContentOffset(value);
188 if (contentOffset) {
189 nativeState.contentOffsetForInstance.set(instance, contentOffset);
190 }
191 }
192}
193
194function tryGetContentOffset(event: unknown): Point | null {
195 try {

Callers 1

fireEventFunction · 0.85

Calls 3

isEditableTextInputFunction · 0.90
isHostScrollViewFunction · 0.90
tryGetContentOffsetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…