Skip to content

Add supportsViewTransition host config flag#662

Closed
everettbu wants to merge 1 commit into
mainfrom
supportsViewTransition
Closed

Add supportsViewTransition host config flag#662
everettbu wants to merge 1 commit into
mainfrom
supportsViewTransition

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35965
Original author: zeyap


Summary

  • Adds a supportsViewTransition host config flag (like supportsMutation, supportsHydration) so the reconciler can check renderer capability directly
  • Extracts view-transition stubs from ReactFiberConfigWithNoMutation.js into a new ReactFiberConfigWithNoViewTransition.js
  • Replaces !supportsMutation && !supportsPersistence checks in the reconciler with !supportsViewTransition
  • Sets supportsViewTransition = true for DOM and Fabric renderers, false for Native (paper), ART, and test-renderer

Test plan

  • Existing view transition tests should pass unchanged
  • yarn flow for dom-node, fabric, native renderers

@greptile-apps

greptile-apps Bot commented Mar 5, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a supportsViewTransition host config flag to the reconciler, extracting view transition stubs from ReactFiberConfigWithNoMutation.js into a new ReactFiberConfigWithNoViewTransition.js. The reconciler's guards are correctly updated from supportsMutation to supportsViewTransition. DOM and Fabric set the flag to true; ART, Native (paper), and test-renderer set it to false via the new no-op module.

  • The core refactor in the reconciler (ReactFiberCommitViewTransitions.js, ReactFiberCommitWork.js) is correct — all three view-transition guard checks and the passive mount guard are properly updated.
  • Missing exports in ART and Native renderers: Both ReactFiberConfigART.js and ReactFiberConfigNative.js previously defined GestureTimeline (type) and getCurrentGestureOffset inline alongside the view transition stubs. This PR removed them along with the stubs, but they were not added to ReactFiberConfigWithNoViewTransition.js. Since these renderers have supportsMutation = true and don't import from ReactFiberConfigWithNoMutation.js (which still has them), both builds will have missing exports that the reconciler depends on.
  • Unused import cleanup (TransitionTypes, enableProfilerTimer) in the Native and test-renderer configs is correct.

Confidence Score: 2/5

  • This PR has missing exports that will break the ART and Native (paper) renderer builds.
  • The core reconciler changes are correct and well-structured. However, GestureTimeline and getCurrentGestureOffset were removed from both ART and Native renderer configs without being replaced — these are required by the reconciler's ReactFiberGestureScheduler.js and ReactFiberWorkLoop.js. Combined with the previously-flagged Fabric renderer issue, three renderer configs have missing exports.
  • packages/react-art/src/ReactFiberConfigART.js and packages/react-native-renderer/src/ReactFiberConfigNative.js are missing GestureTimeline and getCurrentGestureOffset exports. packages/react-reconciler/src/ReactFiberConfigWithNoViewTransition.js may need these added if gestures should be bundled with view transition stubs.

Important Files Changed

Filename Overview
packages/react-art/src/ReactFiberConfigART.js Removed view transition stubs and added NoViewTransition import, but also removed GestureTimeline type and getCurrentGestureOffset without replacement — these are missing exports.
packages/react-native-renderer/src/ReactFiberConfigNative.js Removed view transition stubs and added NoViewTransition import, but also removed GestureTimeline type and getCurrentGestureOffset without replacement — these are missing exports.
packages/react-reconciler/src/ReactFiberConfigWithNoViewTransition.js New file with view transition shims. Missing GestureTimeline type and getCurrentGestureOffset that some renderers need (previously reported). Otherwise well-structured.
packages/react-reconciler/src/ReactFiberConfigWithNoMutation.js Correctly moved view transition exports out; retains GestureTimeline and getCurrentGestureOffset but only covers renderers that import from this file (persistence-based).
packages/react-reconciler/src/ReactFiberCommitViewTransitions.js Correctly replaced supportsMutation with supportsViewTransition in all three view-transition-specific guard checks.
packages/react-reconciler/src/ReactFiberCommitWork.js Added supportsViewTransition import and correctly replaced the guard for restoreRootViewTransitionName.
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js Added supportsViewTransition = true export. Correct — DOM supports view transitions.
packages/react-test-renderer/src/ReactFiberConfigTestHost.js Removed view transition stubs and added NoViewTransition import. Test renderer has its own GestureTimeline at line 370 so no missing export issue here.

Comments Outside Diff (2)

  1. packages/react-art/src/ReactFiberConfigART.js, line 252 (link)

    Missing GestureTimeline and getCurrentGestureOffset exports

    This PR removed ART's inline definitions of GestureTimeline (type) and getCurrentGestureOffset (function) along with the view transition stubs, but these gesture-related exports were not added to ReactFiberConfigWithNoViewTransition.js. Since ART has supportsMutation = true (line 416), it does not import from ReactFiberConfigWithNoMutation.js (which still has these exports).

    The reconciler imports GestureTimeline from ./ReactFiberConfig in ReactFiberGestureScheduler.js (line 12) and ReactFiberWorkLoop.js (line 33), and imports getCurrentGestureOffset in ReactFiberGestureScheduler.js (line 27). Without either an inline definition or a re-export from one of the WithNo* modules, the ART build will have missing exports.

    Either add GestureTimeline and getCurrentGestureOffset to ReactFiberConfigWithNoViewTransition.js, or re-add the inline definitions here:

    export type GestureTimeline = null;
    
    export function getCurrentGestureOffset(provider: GestureTimeline): number {
      throw new Error('startGestureTransition is not yet supported in react-art.');
    }
    
  2. packages/react-native-renderer/src/ReactFiberConfigNative.js, line 112 (link)

    Missing GestureTimeline and getCurrentGestureOffset exports

    Same issue as the ART renderer: this PR removed Native's inline definitions of GestureTimeline (was at line 732) and getCurrentGestureOffset (was at line 734) along with the view transition stubs. Since Native has supportsMutation = true (line 375), it does not import from ReactFiberConfigWithNoMutation.js, and ReactFiberConfigWithNoViewTransition.js doesn't include gesture-related exports either.

    The reconciler imports both symbols from ./ReactFiberConfig (ReactFiberGestureScheduler.js:12,27 and ReactFiberWorkLoop.js:33), so the Native build will fail with missing exports.

    Either add these to ReactFiberConfigWithNoViewTransition.js (if gestures and view transitions should be coupled), or re-add inline definitions here:

    export type GestureTimeline = null;
    
    export function getCurrentGestureOffset(provider: GestureTimeline): number {
      throw new Error(
        'startGestureTransition is not yet supported in React Native.',
      );
    }
    

Fix All in Claude Code Fix All in Codex

Last reviewed commit: 6d2b648

Comment thread packages/react-reconciler/src/ReactFiberConfigWithNoMutation.js
@everettbu
everettbu force-pushed the supportsViewTransition branch from d612573 to db2eee7 Compare March 5, 2026 20:23
@everettbu
everettbu force-pushed the supportsViewTransition branch from db2eee7 to 6d2b648 Compare March 6, 2026 14:23
@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Mar 11, 2026
@everettbu
everettbu deleted the supportsViewTransition branch March 11, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants