Skip to content

Commit 966d270

Browse files
committed
Add feature flag to use microtasks in the React Native Fabric renderer
1 parent 41f0e9d commit 966d270

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/react-native-renderer/src/ReactFiberConfigFabric.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const {
4848
unstable_getCurrentEventPriority: fabricGetCurrentEventPriority,
4949
} = nativeFabricUIManager;
5050

51-
import {diffInCommitPhase} from 'shared/ReactFeatureFlags';
51+
import {diffInCommitPhase, useMicrotasksForSchedulingInNative} from 'shared/ReactFeatureFlags';
5252

5353
const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
5454

@@ -122,7 +122,6 @@ export * from 'react-reconciler/src/ReactFiberConfigWithNoMutation';
122122
export * from 'react-reconciler/src/ReactFiberConfigWithNoHydration';
123123
export * from 'react-reconciler/src/ReactFiberConfigWithNoScopes';
124124
export * from 'react-reconciler/src/ReactFiberConfigWithNoTestSelectors';
125-
export * from 'react-reconciler/src/ReactFiberConfigWithNoMicrotasks';
126125
export * from 'react-reconciler/src/ReactFiberConfigWithNoResources';
127126
export * from 'react-reconciler/src/ReactFiberConfigWithNoSingletons';
128127

@@ -499,3 +498,9 @@ export function waitForCommitToBeReady(): null {
499498
}
500499

501500
export const NotPendingTransition: TransitionStatus = null;
501+
502+
// -------------------
503+
// Microtasks
504+
// -------------------
505+
export const supportsMicrotasks = useMicrotasksForSchedulingInNative;
506+
export const scheduleMicrotask: any = typeof queueMicrotask === 'function' ? queueMicrotask : scheduleTimeout;

packages/shared/ReactFeatureFlags.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ export const enableAsyncActions = __EXPERIMENTAL__;
125125

126126
export const alwaysThrottleRetries = true;
127127

128+
export const useMicrotasksForSchedulingInNative = false;
129+
128130
// -----------------------------------------------------------------------------
129131
// Chopping Block
130132
//

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const {
2121
enableUseRefAccessWarning,
2222
enableDeferRootSchedulingToMicrotask,
2323
alwaysThrottleRetries,
24+
useMicrotasksForSchedulingInNative,
2425
} = dynamicFlags;
2526

2627
// The rest of the flags are static for better dead code elimination.

0 commit comments

Comments
 (0)