Skip to content

Commit

Permalink
React Native sync for revisions c1220eb...a049aa0
Browse files Browse the repository at this point in the history
Summary:
This sync includes the following changes:
- **[f2a59df48](facebook/react@f2a59df48 )**: Remove unstableAvoidThisFallback from OSS ([#22884](facebook/react#22884)) //<salazarm>//
- **[24dd07bd2](facebook/react@24dd07bd2 )**: Add custom element property support behind a flag ([#22184](facebook/react#22184)) //<Joey Arhar>//
- **[72e48b8e1](facebook/react@72e48b8e1 )**: Fix: Don't skip writing updated package.json //<Andrew Clark>//
- **[e39b2c899](facebook/react@e39b2c899 )**: Fix peer deps for use-sync-external-store //<Andrew Clark>//
- **[ec78b135f](facebook/react@ec78b135f )**: Don't override use-sync-external-store peerDeps ([#22882](facebook/react#22882)) //<Andrew Clark>//
- **[5041c37d2](facebook/react@5041c37d2 )**: Remove hydrate option from createRoot ([#22878](facebook/react#22878)) //<salazarm>//
- **[3f9480f0f](facebook/react@3f9480f0f )**: enable continuous replay flag ([#22863](facebook/react#22863)) //<salazarm>//
- **[4729ff6d1](facebook/react@4729ff6d1 )**: Implement identifierPrefix option for useId ([#22855](facebook/react#22855)) //<Andrew Clark>//
- **[ed00d2c3d](facebook/react@ed00d2c3d )**: Remove unused flag ([#22854](facebook/react#22854)) //<Dan Abramov>//
- **[0cc724c77](facebook/react@0cc724c77 )**: update ReactFlightWebpackPlugin to be compatiable with webpack v5 ([#22739](facebook/react#22739)) //<Michelle Chen>//
- **[4e6eec69b](facebook/react@4e6eec69b )**: fix: document can be `null`, not just `undefined` ([#22695](facebook/react#22695)) //<Simen Bekkhus>//

Changelog:
[General][Changed] - React Native sync for revisions c1220eb...a049aa0

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D33062386

fbshipit-source-id: 37e497947efad5696c251096da8a92ccdc6dcea7
  • Loading branch information
kacieb authored and facebook-github-bot committed Dec 14, 2021
1 parent 102b9f3 commit 312efd0
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 192 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
@@ -1 +1 @@
c1220ebdde506de91c8b9693b5cb67ac710c8c89
a049aa015563c2e50f44214c28d186c0bae09ba6
58 changes: 29 additions & 29 deletions Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c63c5718d1b40bee38ff92020247d874>>
* @generated SignedSource<<4b47cfe3313108f4cdeb2cfc4dfea2e5>>
*/

'use strict';
Expand Down Expand Up @@ -156,7 +156,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd;
// when we call document.createEvent(). However this can cause confusing
// errors: https://github.com/facebook/create-react-app/issues/3482
// So we preemptively throw with a better message instead.
if (typeof document === "undefined") {
if (typeof document === "undefined" || document === null) {
throw new Error(
"The `document` global was defined when React was initialized, but is not " +
"defined anymore. This can happen in a test environment if a component " +
Expand Down Expand Up @@ -2868,6 +2868,7 @@ var enableProfilerCommitHooks = true;
var enableLazyElements = false;
var warnAboutStringRefs = false;
var warnOnSubscriptionInsideStartTransition = false;
var enableSuspenseAvoidThisFallback = false;
var enableNewReconciler = false;
var enableLazyContextPropagation = false;

Expand Down Expand Up @@ -6008,7 +6009,7 @@ function flushSyncCallbacks() {
return null;
}

var ReactVersion = "18.0.0-c1220ebdd-20211123";
var ReactVersion = "18.0.0-rc.0-a049aa015-20211213";

var SCHEDULING_PROFILER_VERSION = 1;

Expand Down Expand Up @@ -10448,16 +10449,9 @@ function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {

var props = workInProgress.memoizedProps; // Regular boundaries always capture.

if (props.unstable_avoidThisFallback !== true) {
{
return true;
} // If it's a boundary we should avoid, then we prefer to bubble up to the
// parent boundary if it is currently invisible.

if (hasInvisibleParent) {
return false;
} // If the parent is not able to handle it, we must handle it.

return true;
}
function findFirstSuspended(row) {
var node = row;
Expand Down Expand Up @@ -12206,12 +12200,19 @@ function getIsUpdatingOpaqueValueInRenderPhaseInDEV() {

function mountId() {
var hook = mountWorkInProgressHook();
var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we
// should do this in Fiber, too? Deferring this decision for now because
// there's no other place to store the prefix except for an internal field on
// the public createRoot object, which the fiber tree does not currently have
// a reference to.

var identifierPrefix = root.identifierPrefix;
var id;

{
// Use a lowercase r prefix for client-generated ids.
var globalClientId = globalClientIdCounter++;
id = "r:" + globalClientId.toString(32);
id = identifierPrefix + "r:" + globalClientId.toString(32);
}

hook.memoizedState = id;
Expand Down Expand Up @@ -13742,16 +13743,9 @@ function resetSuspendedComponent(sourceFiber, rootRenderLanes) {

function getNearestSuspenseBoundaryToCapture(returnFiber) {
var node = returnFiber;
var hasInvisibleParentBoundary = hasSuspenseContext(
suspenseStackCursor.current,
InvisibleParentSuspenseContext
);

do {
if (
node.tag === SuspenseComponent &&
shouldCaptureSuspense(node, hasInvisibleParentBoundary)
) {
if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) {
return node;
} // This boundary already captured during this render. Continue to the next
// boundary.
Expand Down Expand Up @@ -14743,7 +14737,8 @@ function completeWork(current, workInProgress, renderLanes) {
// should be able to immediately restart from within throwException.
var hasInvisibleChildContext =
current === null &&
workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
(workInProgress.memoizedProps.unstable_avoidThisFallback !== true ||
!enableSuspenseAvoidThisFallback);

if (
hasInvisibleChildContext ||
Expand Down Expand Up @@ -16566,7 +16561,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
// Mark this subtree context as having at least one invisible parent that could
// handle the fallback state.
// Avoided boundaries are not considered since they cannot handle preferred fallback states.
if (nextProps.unstable_avoidThisFallback !== true) {
{
suspenseContext = addSubtreeSuspenseContext(
suspenseContext,
InvisibleParentSuspenseContext
Expand Down Expand Up @@ -23531,7 +23526,7 @@ function assignFiberPropertiesInDEV(target, source) {
return target;
}

function FiberRootNode(containerInfo, tag, hydrate) {
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
this.tag = tag;
this.containerInfo = containerInfo;
this.pendingChildren = null;
Expand All @@ -23554,6 +23549,7 @@ function FiberRootNode(containerInfo, tag, hydrate) {
this.finishedLanes = NoLanes;
this.entangledLanes = NoLanes;
this.entanglements = createLaneMap(NoLanes);
this.identifierPrefix = identifierPrefix;

{
this.effectDuration = 0;
Expand Down Expand Up @@ -23588,9 +23584,10 @@ function createFiberRoot(
hydrate,
hydrationCallbacks,
isStrictMode,
concurrentUpdatesByDefaultOverride
concurrentUpdatesByDefaultOverride,
identifierPrefix
) {
var root = new FiberRootNode(containerInfo, tag, hydrate);
var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix);
// stateNode is any.

var uninitializedFiber = createHostRootFiber(
Expand Down Expand Up @@ -23737,15 +23734,17 @@ function createContainer(
hydrate,
hydrationCallbacks,
isStrictMode,
concurrentUpdatesByDefaultOverride
concurrentUpdatesByDefaultOverride,
identifierPrefix
) {
return createFiberRoot(
containerInfo,
tag,
hydrate,
hydrationCallbacks,
isStrictMode,
concurrentUpdatesByDefaultOverride
concurrentUpdatesByDefaultOverride,
identifierPrefix
);
}
function updateContainer(element, container, parentComponent, callback) {
Expand Down Expand Up @@ -24539,7 +24538,8 @@ function render(element, containerTag, callback, concurrentRoot) {
false,
null,
false,
null
null,
""
);
roots.set(containerTag, root);
}
Expand Down Expand Up @@ -24603,6 +24603,6 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}

})();
}
55 changes: 22 additions & 33 deletions Libraries/Renderer/implementations/ReactFabric-prod.fb.js
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d2675ef49da99531a7fa8940f853bd5f>>
* @generated SignedSource<<91162956144e0110fdc5f76b4de6f80e>>
*/

"use strict";
Expand Down Expand Up @@ -4076,9 +4076,11 @@ var ContextOnlyDispatcher = {
},
useSyncExternalStore: mountSyncExternalStore,
useId: function() {
var hook = mountWorkInProgressHook();
var id = "r:" + (globalClientIdCounter++).toString(32);
return (hook.memoizedState = id);
var hook = mountWorkInProgressHook(),
identifierPrefix = workInProgressRoot.identifierPrefix,
globalClientId = globalClientIdCounter++;
identifierPrefix = identifierPrefix + "r:" + globalClientId.toString(32);
return (hook.memoizedState = identifierPrefix);
},
unstable_isNewReconciler: !1
},
Expand Down Expand Up @@ -4620,11 +4622,7 @@ function completeWork(current, workInProgress, renderLanes) {
!renderLanes &&
((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1))
)
if (
(null === current &&
!0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) ||
0 !== (suspenseStackCursor.current & 1)
)
if (null === current || 0 !== (suspenseStackCursor.current & 1))
0 === workInProgressRootExitStatus &&
(workInProgressRootExitStatus = 3);
else {
Expand Down Expand Up @@ -5321,11 +5319,9 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
null !== current && null === current.memoizedState
? !1
: 0 !== (suspenseContext & 2));
JSCompiler_temp
? ((showFallback = !0), (workInProgress.flags &= -129))
: (null !== current && null === current.memoizedState) ||
!0 === nextProps.unstable_avoidThisFallback ||
(suspenseContext |= 1);
if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129);
else if (null === current || null !== current.memoizedState)
suspenseContext |= 1;
push(suspenseStackCursor, suspenseContext & 1);
if (null === current) {
current = nextProps.children;
Expand Down Expand Up @@ -6782,8 +6778,6 @@ function handleError(root$jscomp$0, thrownValue) {
}
b: {
sourceFiber$jscomp$0 = returnFiber;
var hasInvisibleParentBoundary =
0 !== (suspenseStackCursor.current & 1);
do {
var JSCompiler_temp;
if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) {
Expand All @@ -6793,12 +6787,6 @@ function handleError(root$jscomp$0, thrownValue) {
? null !== nextState.dehydrated
? !0
: !1
: !0 !==
sourceFiber$jscomp$0.memoizedProps
.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
if (JSCompiler_temp) {
Expand Down Expand Up @@ -7957,7 +7945,7 @@ function createFiberFromPortal(portal, mode, lanes) {
};
return mode;
}
function FiberRootNode(containerInfo, tag, hydrate) {
function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) {
this.tag = tag;
this.containerInfo = containerInfo;
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
Expand All @@ -7970,6 +7958,7 @@ function FiberRootNode(containerInfo, tag, hydrate) {
this.expirationTimes = createLaneMap(-1);
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
this.entanglements = createLaneMap(0);
this.identifierPrefix = identifierPrefix;
}
function createPortal(children, containerInfo, implementation) {
var key =
Expand Down Expand Up @@ -8176,7 +8165,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_925 = {
findFiberByHostInstance: getInstanceFromInstance,
bundleType: 0,
version: "18.0.0-c1220ebdd-20211123",
version: "18.0.0-rc.0-a049aa015-20211213",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function() {
Expand All @@ -8191,7 +8180,7 @@ var roots = new Map(),
}.bind(null, findNodeHandle)
}
};
var internals$jscomp$inline_1179 = {
var internals$jscomp$inline_1178 = {
bundleType: devToolsConfig$jscomp$inline_925.bundleType,
version: devToolsConfig$jscomp$inline_925.version,
rendererPackageName: devToolsConfig$jscomp$inline_925.rendererPackageName,
Expand All @@ -8218,19 +8207,19 @@ var internals$jscomp$inline_1179 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.0.0-c1220ebdd-20211123"
reconcilerVersion: "18.0.0-rc.0-a049aa015-20211213"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1180 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1179 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1180.isDisabled &&
hook$jscomp$inline_1180.supportsFiber
!hook$jscomp$inline_1179.isDisabled &&
hook$jscomp$inline_1179.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1180.inject(
internals$jscomp$inline_1179
(rendererID = hook$jscomp$inline_1179.inject(
internals$jscomp$inline_1178
)),
(injectedHook = hook$jscomp$inline_1180);
(injectedHook = hook$jscomp$inline_1179);
} catch (err) {}
}
exports.createPortal = function(children, containerTag) {
Expand Down Expand Up @@ -8270,7 +8259,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) {
var root = roots.get(containerTag);
root ||
((root = concurrentRoot ? 1 : 0),
(concurrentRoot = new FiberRootNode(containerTag, root, !1)),
(concurrentRoot = new FiberRootNode(containerTag, root, !1, "")),
(root = createFiber(3, null, null, 1 === root ? 1 : 0)),
(concurrentRoot.current = root),
(root.stateNode = concurrentRoot),
Expand Down

0 comments on commit 312efd0

Please sign in to comment.