Skip to content

Commit

Permalink
Add feature flag to use microtasks in the React Native Fabric renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
rubennorte committed Sep 11, 2023
1 parent 41f0e9d commit 966d270
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/react-native-renderer/src/ReactFiberConfigFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const {
unstable_getCurrentEventPriority: fabricGetCurrentEventPriority,
} = nativeFabricUIManager;

import {diffInCommitPhase} from 'shared/ReactFeatureFlags';
import {diffInCommitPhase, useMicrotasksForSchedulingInNative} from 'shared/ReactFeatureFlags';

const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;

Expand Down Expand Up @@ -122,7 +122,6 @@ export * from 'react-reconciler/src/ReactFiberConfigWithNoMutation';
export * from 'react-reconciler/src/ReactFiberConfigWithNoHydration';
export * from 'react-reconciler/src/ReactFiberConfigWithNoScopes';
export * from 'react-reconciler/src/ReactFiberConfigWithNoTestSelectors';
export * from 'react-reconciler/src/ReactFiberConfigWithNoMicrotasks';
export * from 'react-reconciler/src/ReactFiberConfigWithNoResources';
export * from 'react-reconciler/src/ReactFiberConfigWithNoSingletons';

Expand Down Expand Up @@ -499,3 +498,9 @@ export function waitForCommitToBeReady(): null {
}

export const NotPendingTransition: TransitionStatus = null;

// -------------------
// Microtasks
// -------------------
export const supportsMicrotasks = useMicrotasksForSchedulingInNative;
export const scheduleMicrotask: any = typeof queueMicrotask === 'function' ? queueMicrotask : scheduleTimeout;
2 changes: 2 additions & 0 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export const enableAsyncActions = __EXPERIMENTAL__;

export const alwaysThrottleRetries = true;

export const useMicrotasksForSchedulingInNative = false;

// -----------------------------------------------------------------------------
// Chopping Block
//
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const {
enableUseRefAccessWarning,
enableDeferRootSchedulingToMicrotask,
alwaysThrottleRetries,
useMicrotasksForSchedulingInNative,
} = dynamicFlags;

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

0 comments on commit 966d270

Please sign in to comment.