mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor InterruptibleRendering Fantom test to use dispatchNativeEvent (#50957)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50957 Changelog: [internal] Now we can use the higher level API for event dispatching in this test. Reviewed By: javache Differential Revision: D73663626 fbshipit-source-id: 961af26f62128f093c71ad14f457ac8544348415
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a120c5c4db
commit
9ae7f7fcc1
+3
-1
@@ -348,7 +348,9 @@ export function dispatchNativeEvent(
|
||||
enqueueNativeEvent(node, type, payload, options);
|
||||
});
|
||||
|
||||
runWorkLoop();
|
||||
if (!flushingQueue) {
|
||||
runWorkLoop();
|
||||
}
|
||||
}
|
||||
|
||||
export type ScrollEventOptions = {
|
||||
|
||||
+22
-26
@@ -43,18 +43,16 @@ describe('discrete event category', () => {
|
||||
if (interruptRendering) {
|
||||
interruptRendering = false;
|
||||
const element = ensureReactNativeElement(textInputRef.current);
|
||||
Fantom.runOnUIThread(() => {
|
||||
Fantom.enqueueNativeEvent(
|
||||
element,
|
||||
'change',
|
||||
{
|
||||
text: 'update from native',
|
||||
},
|
||||
{
|
||||
category: NativeEventCategory.Discrete,
|
||||
},
|
||||
);
|
||||
});
|
||||
Fantom.dispatchNativeEvent(
|
||||
element,
|
||||
'change',
|
||||
{
|
||||
text: 'update from native',
|
||||
},
|
||||
{
|
||||
category: NativeEventCategory.Discrete,
|
||||
},
|
||||
);
|
||||
// We must schedule a task that is run right after the above native event is
|
||||
// processed to be able to observe the results of rendering.
|
||||
Fantom.scheduleTask(afterUpdate);
|
||||
@@ -149,21 +147,19 @@ describe('continuous event category', () => {
|
||||
if (interruptRendering) {
|
||||
interruptRendering = false;
|
||||
const element = ensureReactNativeElement(textInputRef.current);
|
||||
Fantom.runOnUIThread(() => {
|
||||
Fantom.enqueueNativeEvent(
|
||||
element,
|
||||
'selectionChange',
|
||||
{
|
||||
selection: {
|
||||
start: 1,
|
||||
end: 5,
|
||||
},
|
||||
Fantom.dispatchNativeEvent(
|
||||
element,
|
||||
'selectionChange',
|
||||
{
|
||||
selection: {
|
||||
start: 1,
|
||||
end: 5,
|
||||
},
|
||||
{
|
||||
category: NativeEventCategory.Continuous,
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
{
|
||||
category: NativeEventCategory.Continuous,
|
||||
},
|
||||
);
|
||||
}
|
||||
useEffect(() => {
|
||||
effectMock({text, deferredText});
|
||||
|
||||
Reference in New Issue
Block a user