mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Enables Basic View Transition support for React Native Fabric renderer (#35764)
## Summary Enables Basic View Transition support for React Native Fabric renderer. **Implemented:** - Added FabricUIManager bindings for view transition methods: `applyViewTransitionName`, `startViewTransition` - Implemented `startViewTransition` with proper callback orchestration (mutation → layout → afterMutation → spawnedWork → passive) - Added fallback behavior that flushes work synchronously when Fabric's `startViewTransition` returns null (e.g., when the ViewTransition ReactNativeFeatureFlag is not enabled) - Added Flow type declarations for new FabricUIManager methods - Stubbed with `__DEV__` warnings for all the other view transition config functions that are not yet implemented This allows React Native apps using Fabric to leverage the View Transition API for coordinated animations during state transitions, with graceful degradation when the native side doesn't support it. Below are diagrams of proposed architecture in fabric, and observation of what/when config functions get called during a basic shared transition example <img width="2290" height="1529" alt="Untitled-2026-03-19-1240" src="https://github.com/user-attachments/assets/192c9169-bc25-449c-a33b-dfec67179e7f" /> ## How did you test this change? - [x] `yarn flow fabric` - Flow type checks pass - [x] `yarn lint` - Lint checks pass - [x] Manually tested in Android catalyst app with `enableViewTransition` and `enableViewTransitionForPersistenceMode `in `ReactFeatureFlags.test-renderer.native-fb.js` and View Transition enabled via ReactNativeFeatureFlag - [x] Verified in the minified `ReactFabric-dev.fb.js` that the 'shim' config functions are not included - [x] Verified fallback behavior logs warning in `__DEV__` and flushes work synchronously when ViewTransition flag isn't enabled in Fabric
This commit is contained in:
@@ -567,5 +567,6 @@
|
||||
"579": "Invalid data for bytes stream.",
|
||||
"580": "Server Function has too many bound arguments. Received %s but the limit is %s.",
|
||||
"581": "BigInt is too large. Received %s digits but the limit is %s.",
|
||||
"582": "Referenced Blob is not a Blob."
|
||||
"582": "Referenced Blob is not a Blob.",
|
||||
"583": "The current renderer does not support view transitions. This error is likely caused by a bug in React. Please file an issue."
|
||||
}
|
||||
|
||||
+9
@@ -301,5 +301,14 @@ declare const nativeFabricUIManager: {
|
||||
unstable_ContinuousEventPriority: number,
|
||||
unstable_IdleEventPriority: number,
|
||||
unstable_getCurrentEventPriority: () => number,
|
||||
applyViewTransitionName: (
|
||||
node: Object,
|
||||
name: string,
|
||||
className: ?string,
|
||||
) => void,
|
||||
startViewTransition: (mutationCallback: () => void) => {
|
||||
finished: Promise<void>,
|
||||
ready: Promise<void>,
|
||||
},
|
||||
...
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user