Skip to content

Commit

Permalink
React Native sync for revisions 2a7bb41...b8fda6c
Browse files Browse the repository at this point in the history
Summary:
This sync includes the following changes:
- **[b8fda6cab](facebook/react@b8fda6cab )**: [React Native] Set allowConcurrentByDefault = true ([#21491](facebook/react#21491)) //<Ricky>//
- **[1bb8987cc](facebook/react@1bb8987cc )**: Renamed function in error log issue #21446 ([#21449](facebook/react#21449)) //<faebzz>//
- **[bd070eb2c](facebook/react@bd070eb2c )**: Enable setJSResponder/setIsJSResponder for React Native Fabric ([#21439](facebook/react#21439)) //<Joshua Gross>//
- **[e9a4a44aa](facebook/react@e9a4a44aa )**: Add back root override for strict mode ([#21428](facebook/react#21428)) //<Ricky>//
- **[d1542de3a](facebook/react@d1542de3a )**: Unify React.memo and React.forwardRef display name logic ([#21392](facebook/react#21392)) //<Brian Vaughn>//
- **[9a130e1de](facebook/react@9a130e1de )**: StrictMode includes strict effects by default ([#21418](facebook/react#21418)) //<Brian Vaughn>//
- **[15fb8c304](facebook/react@15fb8c304 )**: createRoot API is no longer strict by default ([#21417](facebook/react#21417)) //<Brian Vaughn>//
- **[aea7c2aab](facebook/react@aea7c2aab )**: Re-land "Support nesting of startTransition and flushSync (alt) ([#21149](facebook/react#21149))" //<Andrew Clark>//
- **[bacc87068](facebook/react@bacc87068 )**: Re-land "Flush discrete passive effects before paint ([#21150](facebook/react#21150))" //<Andrew Clark>//
- **[098600c42](facebook/react@098600c42 )**: Re-land "Fix: flushSync changes priority inside effect ([#21122](facebook/react#21122))" //<Andrew Clark>//
- **[df420bc0a](facebook/react@df420bc0a )**: Re-land "Delete LanePriority type ([#21090](facebook/react#21090))" //<Andrew Clark>//
- **[ab5b37927](facebook/react@ab5b37927 )**: Re-land "Clean up host pointers in level 2 of clean-up flag ([#21112](facebook/react#21112))" //<Andrew Clark>//
- **[fd907c1f1](facebook/react@fd907c1f1 )**: Re-land "Use highest priority lane to detect interruptions ([#21088](facebook/react#21088))"" //<Andrew Clark>//
- **[269dd6ec5](facebook/react@269dd6ec5 )**: subtreeFlag warning: Fix legacy suspense false positive ([#21388](facebook/react#21388)) //<Andrew Clark>//
- **[9e9dac650](facebook/react@9e9dac650 )**: Add unstable_concurrentUpdatesByDefault ([#21227](facebook/react#21227)) //<Ricky>//
- **[86f3385d9](facebook/react@86f3385d9 )**: Revert "Use highest priority lane to detect interruptions ([#21088](facebook/react#21088))" //<Andrew Clark>//
- **[c6702656f](facebook/react@c6702656f )**: Revert "Clean up host pointers in level 2 of clean-up flag ([#21112](facebook/react#21112))" //<Andrew Clark>//
- **[1bd41c664](facebook/react@1bd41c664 )**: Revert "Delete LanePriority type ([#21090](facebook/react#21090))" //<Andrew Clark>//
- **[e7e0a90bd](facebook/react@e7e0a90bd )**: Revert "Fix: flushSync changes priority inside effect ([#21122](facebook/react#21122))" //<Andrew Clark>//
- **[7bac7607a](facebook/react@7bac7607a )**: Revert "Flush discrete passive effects before paint ([#21150](facebook/react#21150))" //<Andrew Clark>//
- **[207d4c3a5](facebook/react@207d4c3a5 )**: Revert "Support nesting of startTransition and flushSync (alt) ([#21149](facebook/react#21149))" //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 2a7bb41...b8fda6c

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D28351439

fbshipit-source-id: 29620f96c9fb9f02b0d856111d3882d3c69fd1c5
  • Loading branch information
Andrei Shikov authored and facebook-github-bot committed May 11, 2021
1 parent 1cd9736 commit 10b9308
Show file tree
Hide file tree
Showing 13 changed files with 743 additions and 549 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2a7bb4154809f1f4e17ffbdde1342bd4ce91ea37
b8fda6cabc7efc53356d87c6516d6a3d7eb1253c
171 changes: 106 additions & 65 deletions Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e849805d384d655a0b454ba748de33e0>>
* @generated SignedSource<<8974e8c964125552d627281e52405ecc>>
*/

'use strict';
Expand Down Expand Up @@ -2515,8 +2515,25 @@ var ReactFabricGlobalResponderHandler = {
fromOrToStateNode && fromOrToStateNode.canonical._internalInstanceHandle
);

if (isFabric);
else {
if (isFabric) {
if (from) {
// equivalent to clearJSResponder
nativeFabricUIManager.setIsJSResponder(
from.stateNode.node,
false,
blockNativeResponder || false
);
}

if (to) {
// equivalent to setJSResponder
nativeFabricUIManager.setIsJSResponder(
to.stateNode.node,
true,
blockNativeResponder || false
);
}
} else {
if (to !== null) {
var tag = to.stateNode.canonical._nativeTag;
ReactNativePrivateInterface.UIManager.setJSResponder(
Expand Down Expand Up @@ -2620,11 +2637,16 @@ function getIteratorFn(maybeIterable) {
}

function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;

if (displayName) {
return displayName;
}

var functionName = innerType.displayName || innerType.name || "";
return (
outerType.displayName ||
(functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName)
);
return functionName !== ""
? wrapperName + "(" + functionName + ")"
: wrapperName;
} // Keep in sync with react-reconciler/getComponentNameFromFiber

function getContextName(type) {
Expand All @@ -2640,7 +2662,7 @@ function getComponentNameFromType(type) {
{
if (typeof type.tag === "number") {
error(
"Received an unexpected object in getComponentName(). " +
"Received an unexpected object in getComponentNameFromType(). " +
"This is likely a bug in React. Please file an issue."
);
}
Expand Down Expand Up @@ -2691,7 +2713,13 @@ function getComponentNameFromType(type) {
return getWrappedName(type, type.render, "ForwardRef");

case REACT_MEMO_TYPE:
return getComponentNameFromType(type.type);
var outerName = type.displayName || null;

if (outerName !== null) {
return outerName;
}

return getComponentNameFromType(type.type) || "Memo";

case REACT_LAZY_TYPE: {
var lazyComponent = type;
Expand Down Expand Up @@ -4009,6 +4037,29 @@ function onCommitUnmount(fiber) {
}
}

var NoMode =
/* */
0; // TODO: Remove ConcurrentMode by reading from the root tag instead

var ConcurrentMode =
/* */
1;
var ProfileMode =
/* */
2;
var DebugTracingMode =
/* */
4;
var StrictLegacyMode =
/* */
8;
var StrictEffectsMode =
/* */
16;
var ConcurrentUpdatesByDefaultMode =
/* */
32;

// If those values are changed that package should be rebuilt and redeployed.

var TotalLanes = 31;
Expand Down Expand Up @@ -4260,6 +4311,15 @@ function getNextLanes(root, wipLanes) {
return wipLanes;
}
}

if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode);
else if ((nextLanes & InputContinuousLane) !== NoLanes) {
// When updates are sync by default, we entangle continuous priority updates
// and default updates, so they render in the same batch. The only reason
// they use separate lanes is because continuous updates should interrupt
// transitions, but default updates should not.
nextLanes |= pendingLanes & DefaultLane;
} // Check for entangled lanes and add them to the batch.
//
// A lane is said to be entangled with another when it's not allowed to render
// in a batch that does not also include the other lane. Typically we do this
Expand Down Expand Up @@ -4448,9 +4508,17 @@ function shouldTimeSlice(root, lanes) {
return false;
}

{
if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) {
// Concurrent updates by default always use time slicing.
return true;
}

var SyncDefaultLanes =
InputContinuousHydrationLane |
InputContinuousLane |
DefaultHydrationLane |
DefaultLane;
return (lanes & SyncDefaultLanes) === NoLanes;
}
function isTransitionLane(lane) {
return (lane & TransitionLanes) !== 0;
Expand Down Expand Up @@ -5744,27 +5812,7 @@ var Passive$1 =
/* */
4;

var ReactVersion = "17.0.3-2a7bb4154";

var NoMode =
/* */
0; // TODO: Remove ConcurrentMode by reading from the root tag instead

var ConcurrentMode =
/* */
1;
var ProfileMode =
/* */
2;
var DebugTracingMode =
/* */
4;
var StrictLegacyMode =
/* */
8;
var StrictEffectsMode =
/* */
16;
var ReactVersion = "17.0.3-b8fda6cab";

var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
var NoTransition = 0;
Expand Down Expand Up @@ -10148,7 +10196,12 @@ function renderWithHooks(

if (
current !== null &&
(current.flags & StaticMask) !== (workInProgress.flags & StaticMask)
(current.flags & StaticMask) !== (workInProgress.flags & StaticMask) && // Disable this warning in legacy mode, because legacy Suspense is weird
// and creates false positives. To make this work in legacy mode, we'd
// need to mark fibers that commit in an incomplete state, somehow. For
// now I'll disable the warning that most of the bugs that would trigger
// it are either exclusive to concurrent mode or exist in both.
(current.mode & ConcurrentMode) !== NoMode
) {
error(
"Internal React error: Expected static flag was missing. Please " +
Expand Down Expand Up @@ -21092,27 +21145,27 @@ function resetWorkInProgress(workInProgress, renderLanes) {

return workInProgress;
}
function createHostRootFiber(tag, strictModeLevelOverride) {
function createHostRootFiber(
tag,
isStrictMode,
concurrentUpdatesByDefaultOverride
) {
var mode;

if (tag === ConcurrentRoot) {
mode = ConcurrentMode;

if (strictModeLevelOverride !== null) {
if (strictModeLevelOverride >= 1) {
mode |= StrictLegacyMode;
}
if (isStrictMode === true) {
mode |= StrictLegacyMode;

{
if (strictModeLevelOverride >= 2) {
mode |= StrictEffectsMode;
}
}
} else {
{
mode |= StrictLegacyMode;
mode |= StrictEffectsMode;
}
}

{
mode |= ConcurrentUpdatesByDefaultMode;
}
} else {
mode = NoMode;
}
Expand Down Expand Up @@ -21163,22 +21216,8 @@ function createFiberFromTypeAndProps(
break;

case REACT_STRICT_MODE_TYPE:
fiberTag = Mode; // Legacy strict mode (<StrictMode> without any level prop) defaults to level 1.

var level =
pendingProps.unstable_level == null ? 1 : pendingProps.unstable_level; // Levels cascade; higher levels inherit all lower level modes.
// It is explicitly not supported to lower a mode with nesting, only to increase it.

if (level >= 1) {
mode |= StrictLegacyMode;
}

{
if (level >= 2) {
mode |= StrictEffectsMode;
}
}

fiberTag = Mode;
mode |= StrictLegacyMode | StrictEffectsMode;
break;

case REACT_PROFILER_TYPE:
Expand Down Expand Up @@ -21470,12 +21509,13 @@ function createFiberRoot(
tag,
hydrate,
hydrationCallbacks,
strictModeLevelOverride
isStrictMode,
concurrentUpdatesByDefaultOverride
) {
var root = new FiberRootNode(containerInfo, tag, hydrate);
// stateNode is any.

var uninitializedFiber = createHostRootFiber(tag, strictModeLevelOverride);
var uninitializedFiber = createHostRootFiber(tag, isStrictMode);
root.current = uninitializedFiber;
uninitializedFiber.stateNode = root;

Expand Down Expand Up @@ -21613,14 +21653,15 @@ function createContainer(
tag,
hydrate,
hydrationCallbacks,
strictModeLevelOverride
isStrictMode,
concurrentUpdatesByDefaultOverride
) {
return createFiberRoot(
containerInfo,
tag,
hydrate,
hydrationCallbacks,
strictModeLevelOverride
isStrictMode
);
}
function updateContainer(element, container, parentComponent, callback) {
Expand Down Expand Up @@ -22385,7 +22426,7 @@ function render(element, containerTag, callback) {
if (!root) {
// TODO (bvaughn): If we decide to keep the wrapper component,
// We could create a wrapper for containerTag as well to reduce special casing.
root = createContainer(containerTag, LegacyRoot, false, null, null);
root = createContainer(containerTag, LegacyRoot, false, null, false);
roots.set(containerTag, root);
}

Expand Down
Loading

0 comments on commit 10b9308

Please sign in to comment.