Skip to content

Commit 3bc2d41

Browse files
authored
[noop] Fix createContainer argument order in the Fiber implementation (facebook#35945)
1 parent 5e42791 commit 3bc2d41

12 files changed

+590
-334
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ module.exports = {
626626
FinalizationRegistry: 'readonly',
627627
Exclude: 'readonly',
628628
Omit: 'readonly',
629+
Pick: 'readonly',
629630
Keyframe: 'readonly',
630631
PropertyIndexedKeyframes: 'readonly',
631632
KeyframeAnimationOptions: 'readonly',

packages/react-noop-renderer/src/ReactFiberConfigNoop.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
* @flow
88
*/
99

10+
export * from './ReactFiberConfigNoopHydration';
11+
export * from './ReactFiberConfigNoopScopes';
12+
export * from './ReactFiberConfigNoopTestSelectors';
13+
export * from './ReactFiberConfigNoopResources';
14+
export * from './ReactFiberConfigNoopSingletons';
15+
// createReactNoop will overwrite these with the mutation or persistence versions.
16+
export * from './ReactFiberConfigNoopNoMutation';
17+
export * from './ReactFiberConfigNoopNoPersistence';
18+
1019
export type HostContext = Object;
1120

1221
export type TextInstance = {
@@ -31,3 +40,9 @@ export type Instance = {
3140
export type PublicInstance = Instance;
3241

3342
export type TransitionStatus = mixed;
43+
44+
export type Container = {
45+
rootID: string,
46+
children: Array<Instance | TextInstance>,
47+
pendingChildren: Array<Instance | TextInstance>,
48+
};
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support hydration
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'react-noop-renderer does not support hydration. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// Hydration (when unsupported)
22+
export type ActivityInstance = mixed;
23+
export type SuspenseInstance = mixed;
24+
export const supportsHydration = false;
25+
export const isSuspenseInstancePending = shim;
26+
export const isSuspenseInstanceFallback = shim;
27+
export const getSuspenseInstanceFallbackErrorDetails = shim;
28+
export const registerSuspenseInstanceRetry = shim;
29+
export const canHydrateFormStateMarker = shim;
30+
export const isFormStateMarkerMatching = shim;
31+
export const getNextHydratableSibling = shim;
32+
export const getNextHydratableSiblingAfterSingleton = shim;
33+
export const getFirstHydratableChild = shim;
34+
export const getFirstHydratableChildWithinContainer = shim;
35+
export const getFirstHydratableChildWithinActivityInstance = shim;
36+
export const getFirstHydratableChildWithinSuspenseInstance = shim;
37+
export const getFirstHydratableChildWithinSingleton = shim;
38+
export const canHydrateInstance = shim;
39+
export const canHydrateTextInstance = shim;
40+
export const canHydrateActivityInstance = shim;
41+
export const canHydrateSuspenseInstance = shim;
42+
export const hydrateInstance = shim;
43+
export const hydrateTextInstance = shim;
44+
export const hydrateActivityInstance = shim;
45+
export const hydrateSuspenseInstance = shim;
46+
export const getNextHydratableInstanceAfterActivityInstance = shim;
47+
export const getNextHydratableInstanceAfterSuspenseInstance = shim;
48+
export const finalizeHydratedChildren = shim;
49+
export const commitHydratedInstance = shim;
50+
export const commitHydratedContainer = shim;
51+
export const commitHydratedActivityInstance = shim;
52+
export const commitHydratedSuspenseInstance = shim;
53+
export const flushHydrationEvents = shim;
54+
export const clearActivityBoundary = shim;
55+
export const clearSuspenseBoundary = shim;
56+
export const clearActivityBoundaryFromContainer = shim;
57+
export const clearSuspenseBoundaryFromContainer = shim;
58+
export const hideDehydratedBoundary = shim;
59+
export const unhideDehydratedBoundary = shim;
60+
export const shouldDeleteUnhydratedTailInstances = shim;
61+
export const diffHydratedPropsForDevWarnings = shim;
62+
export const diffHydratedTextForDevWarnings = shim;
63+
export const describeHydratableInstanceForDevWarnings = shim;
64+
export const validateHydratableInstance = shim;
65+
export const validateHydratableTextInstance = shim;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support mutation
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'This entrypoint of react-noop-renderer does not support mutation. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// Mutation (when unsupported)
22+
export const supportsMutation = false;
23+
export const cloneMutableInstance = shim;
24+
export const cloneMutableTextInstance = shim;
25+
export const appendChild = shim;
26+
export const appendChildToContainer = shim;
27+
export const commitTextUpdate = shim;
28+
export const commitMount = shim;
29+
export const commitUpdate = shim;
30+
export const insertBefore = shim;
31+
export const insertInContainerBefore = shim;
32+
export const removeChild = shim;
33+
export const removeChildFromContainer = shim;
34+
export const resetTextContent = shim;
35+
export const hideInstance = shim;
36+
export const hideTextInstance = shim;
37+
export const unhideInstance = shim;
38+
export const unhideTextInstance = shim;
39+
export const clearContainer = shim;
40+
export const applyViewTransitionName = shim;
41+
export const restoreViewTransitionName = shim;
42+
export const cancelViewTransitionName = shim;
43+
export const cancelRootViewTransitionName = shim;
44+
export const restoreRootViewTransitionName = shim;
45+
export const cloneRootViewTransitionContainer = shim;
46+
export const removeRootViewTransitionClone = shim;
47+
export type InstanceMeasurement = null;
48+
export const measureInstance = shim;
49+
export const measureClonedInstance = shim;
50+
export const wasInstanceInViewport = shim;
51+
export const hasInstanceChanged = shim;
52+
export const hasInstanceAffectedParent = shim;
53+
export const startViewTransition = shim;
54+
export type RunningViewTransition = null;
55+
export const startGestureTransition = shim;
56+
export const stopViewTransition = shim;
57+
export const addViewTransitionFinishedListener = shim;
58+
export type ViewTransitionInstance = null | {name: string, ...};
59+
export const createViewTransitionInstance = shim;
60+
export type GestureTimeline = any;
61+
export const getCurrentGestureOffset = shim;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support persistence
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'This entrypoint of react-noop-renderer does not support persistence. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// Persistence (when unsupported)
22+
export const supportsPersistence = false;
23+
export const cloneInstance = shim;
24+
export const createContainerChildSet = shim;
25+
export const appendChildToContainerChildSet = shim;
26+
export const finalizeContainerChildren = shim;
27+
export const replaceContainerChildren = shim;
28+
export const cloneHiddenInstance = shim;
29+
export const cloneHiddenTextInstance = shim;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support hydration
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'react-noop-renderer does not support Resources. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
export type HoistableRoot = mixed;
22+
export type Resource = mixed;
23+
24+
// Resources (when unsupported)
25+
export const supportsResources = false;
26+
export const isHostHoistableType = shim;
27+
export const getHoistableRoot = shim;
28+
export const getResource = shim;
29+
export const acquireResource = shim;
30+
export const releaseResource = shim;
31+
export const hydrateHoistable = shim;
32+
export const mountHoistable = shim;
33+
export const unmountHoistable = shim;
34+
export const createHoistableInstance = shim;
35+
export const prepareToCommitHoistables = shim;
36+
export const mayResourceSuspendCommit = shim;
37+
export const preloadResource = shim;
38+
export const suspendResource = shim;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support React Scopes
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'react-noop-renderer does not support React Scopes. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// React Scopes (when unsupported)
22+
export const prepareScopeUpdate = shim;
23+
export const getInstanceFromScope = shim;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support mutation
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): any {
14+
throw new Error(
15+
'react-noop-renderer does not support Singletons. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// Resources (when unsupported)
22+
export const supportsSingletons = false;
23+
export const resolveSingletonInstance = shim;
24+
export const acquireSingletonInstance = shim;
25+
export const releaseSingletonInstance = shim;
26+
export const isHostSingletonType = shim;
27+
export const isSingletonScope = shim;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// Renderers that don't support test selectors
11+
// can re-export everything from this module.
12+
13+
function shim(...args: any): empty {
14+
throw new Error(
15+
'react-noop-renderer does not support test selectors. ' +
16+
'This error is likely caused by a bug in React. ' +
17+
'Please file an issue.',
18+
);
19+
}
20+
21+
// Test selectors (when unsupported)
22+
export const supportsTestSelectors = false;
23+
export const findFiberRoot = shim;
24+
export const getBoundingRect = shim;
25+
export const getTextContent = shim;
26+
export const isHiddenSubtree = shim;
27+
export const matchAccessibilityRole = shim;
28+
export const setFocusIfFocusable = shim;
29+
export const setupIntersectionObserver = shim;

0 commit comments

Comments
 (0)