Files
react/packages/shared/forks/ReactFeatureFlags.www.js
Jack PopeandGitHub 3434ff4f4b Add scrollIntoView to fragment instances (#32814)
This adds `experimental_scrollIntoView(alignToTop)`. It doesn't yet
support `scrollIntoView(options)`.

Cases:
- No host children: Without host children, we represent the virtual
space of the Fragment by attempting to scroll to the nearest edge by
using its siblings. If the preferred sibling is not found, we'll try the
other side, and then the parent.
- 1 or more host children: In order to handle the case of children
spread between multiple scroll containers, we scroll to each child in
reverse order based on the `alignToTop` flag.

Due to the complexity of multiple scroll containers and dealing with
portals, I've added this under a separate feature flag with an
experimental prefix. We may stabilize it along with the other APIs, but
this allows us to not block the whole feature on it.

This PR was previously implementing a much more complex approach to
handling multiple scroll containers and portals. We're going to start
with the simple loop and see if we can find any concrete use cases where
that doesn't suffice. 01f31d4301 is the
diff between approaches here.
2025-08-27 18:05:57 -04:00

118 lines
3.8 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
import typeof * as ExportsType from './ReactFeatureFlags.www';
import typeof * as DynamicFeatureFlags from './ReactFeatureFlags.www-dynamic';
// Re-export dynamic flags from the www version.
const dynamicFeatureFlags: DynamicFeatureFlags = require('ReactFeatureFlags');
export const {
alwaysThrottleRetries,
disableLegacyContextForFunctionComponents,
disableSchedulerTimeoutInWorkLoop,
enableHiddenSubtreeInsertionEffectCleanup,
enableInfiniteRenderLoopDetection,
enableNoCloningMemoCache,
enableObjectFiber,
enableRetryLaneExpiration,
enableTransitionTracing,
enableTrustedTypesIntegration,
renameElementSymbol,
retryLaneExpirationMs,
syncLaneExpirationMs,
transitionLaneExpirationMs,
enableViewTransition,
enableComponentPerformanceTrack,
enableScrollEndPolyfill,
enableFragmentRefs,
enableFragmentRefsScrollIntoView,
} = dynamicFeatureFlags;
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
// It's not used anywhere in production yet.
export const enableProfilerTimer = __PROFILE__;
export const enableProfilerCommitHooks = __PROFILE__;
export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableUpdaterTracking = __PROFILE__;
export const enableSuspenseAvoidThisFallback: boolean = true;
export const enableCPUSuspense: boolean = true;
export const enableUseEffectEventHook: boolean = true;
export const enableMoveBefore: boolean = false;
export const disableInputAttributeSyncing: boolean = false;
export const enableLegacyFBSupport: boolean = true;
export const enableYieldingBeforePassive: boolean = false;
export const enableThrottledScheduling: boolean = false;
export const enableHydrationLaneScheduling: boolean = true;
// Logs additional User Timing API marks for use with an experimental profiling tool.
export const enableSchedulingProfiler: boolean =
__PROFILE__ && dynamicFeatureFlags.enableSchedulingProfiler;
export const disableLegacyContext = __EXPERIMENTAL__;
export const enableLegacyCache: boolean = true;
export const enableAsyncIterableChildren: boolean = false;
export const enableTaint: boolean = false;
export const enablePostpone: boolean = false;
export const enableHalt: boolean = false;
// TODO: www currently relies on this feature. It's disabled in open source.
// Need to remove it.
export const disableCommentsAsDOMContainers: boolean = false;
export const enableCreateEventHandleAPI: boolean = true;
export const enableScopeAPI: boolean = true;
export const enableSuspenseCallback: boolean = true;
export const enableLegacyHidden: boolean = true;
export const disableTextareaChildren = __EXPERIMENTAL__;
export const enableFizzExternalRuntime: boolean = true;
export const passChildrenWhenCloningPersistedNodes: boolean = false;
export const enablePersistedModeClonedFlag: boolean = false;
export const enableAsyncDebugInfo: boolean = false;
export const disableClientCache: boolean = true;
export const enableReactTestRendererWarning: boolean = false;
export const disableLegacyMode: boolean = true;
export const enableEagerAlternateStateNodeCleanup: boolean = true;
export const enableGestureTransition: boolean = false;
export const enableSuspenseyImages: boolean = false;
export const enableFizzBlockingRender: boolean = true;
export const enableSrcObject: boolean = false;
export const enableHydrationChangeEvent: boolean = false;
export const enableDefaultTransitionIndicator: boolean = false;
export const ownerStackLimit = 1e4;
// Flow magic to verify the exports of this file match the original version.
((((null: any): ExportsType): FeatureFlagsType): ExportsType);