Skip to content

Commit 5e9b487

Browse files
authored
[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 facebook/react-native#50627 The changes are gated in React Native, so we'll use that feature flag to test this.
1 parent c44e4a2 commit 5e9b487

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import {
1818
NoEventPriority,
1919
DefaultEventPriority,
2020
DiscreteEventPriority,
21+
ContinuousEventPriority,
22+
IdleEventPriority,
2123
type EventPriority,
2224
} from 'react-reconciler/src/ReactEventPriorities';
2325
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
@@ -46,6 +48,8 @@ const {
4648
registerEventHandler,
4749
unstable_DefaultEventPriority: FabricDefaultPriority,
4850
unstable_DiscreteEventPriority: FabricDiscretePriority,
51+
unstable_ContinuousEventPriority: FabricContinuousPriority,
52+
unstable_IdleEventPriority: FabricIdlePriority,
4953
unstable_getCurrentEventPriority: fabricGetCurrentEventPriority,
5054
} = nativeFabricUIManager;
5155

@@ -397,6 +401,10 @@ export function resolveUpdatePriority(): EventPriority {
397401
switch (currentEventPriority) {
398402
case FabricDiscretePriority:
399403
return DiscreteEventPriority;
404+
case FabricContinuousPriority:
405+
return ContinuousEventPriority;
406+
case FabricIdlePriority:
407+
return IdleEventPriority;
400408
case FabricDefaultPriority:
401409
default:
402410
return DefaultEventPriority;

scripts/flow/react-native-host-hooks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ declare const nativeFabricUIManager: {
277277
) => void,
278278
unstable_DefaultEventPriority: number,
279279
unstable_DiscreteEventPriority: number,
280+
unstable_ContinuousEventPriority: number,
281+
unstable_IdleEventPriority: number,
280282
unstable_getCurrentEventPriority: () => number,
281283
...
282284
};

0 commit comments

Comments
 (0)