mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
[RN] Map Fabric priorities to reconciler priorities correctly (#32847)
## Summary This fixes how we map priorities between Fabric and the React reconciler. At the moment, we're only considering default and discrete priorities, when there's a larger range of priorities available. In Fabric, we'll test supporting additional priorities soon. For that test to do something useful, we need the new priorities to be mapped to reconciler priorities correctly, which is what this change is done. > [!IMPORTANT] > At the moment, this is a no-op because Fabric is only reporting default and discrete event priorities. ## How did you test this change? Will test e2e on React Native on top of https://github.com/facebook/react-native/pull/50627 The changes are gated in React Native, so we'll use that feature flag to test this.
This commit is contained in:
@@ -18,6 +18,8 @@ import {
|
||||
NoEventPriority,
|
||||
DefaultEventPriority,
|
||||
DiscreteEventPriority,
|
||||
ContinuousEventPriority,
|
||||
IdleEventPriority,
|
||||
type EventPriority,
|
||||
} from 'react-reconciler/src/ReactEventPriorities';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
|
||||
@@ -46,6 +48,8 @@ const {
|
||||
registerEventHandler,
|
||||
unstable_DefaultEventPriority: FabricDefaultPriority,
|
||||
unstable_DiscreteEventPriority: FabricDiscretePriority,
|
||||
unstable_ContinuousEventPriority: FabricContinuousPriority,
|
||||
unstable_IdleEventPriority: FabricIdlePriority,
|
||||
unstable_getCurrentEventPriority: fabricGetCurrentEventPriority,
|
||||
} = nativeFabricUIManager;
|
||||
|
||||
@@ -397,6 +401,10 @@ export function resolveUpdatePriority(): EventPriority {
|
||||
switch (currentEventPriority) {
|
||||
case FabricDiscretePriority:
|
||||
return DiscreteEventPriority;
|
||||
case FabricContinuousPriority:
|
||||
return ContinuousEventPriority;
|
||||
case FabricIdlePriority:
|
||||
return IdleEventPriority;
|
||||
case FabricDefaultPriority:
|
||||
default:
|
||||
return DefaultEventPriority;
|
||||
|
||||
2
scripts/flow/react-native-host-hooks.js
vendored
2
scripts/flow/react-native-host-hooks.js
vendored
@@ -277,6 +277,8 @@ declare const nativeFabricUIManager: {
|
||||
) => void,
|
||||
unstable_DefaultEventPriority: number,
|
||||
unstable_DiscreteEventPriority: number,
|
||||
unstable_ContinuousEventPriority: number,
|
||||
unstable_IdleEventPriority: number,
|
||||
unstable_getCurrentEventPriority: () => number,
|
||||
...
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user