Skip to content

Commit 10b9308

Browse files
Andrei Shikovfacebook-github-bot
Andrei Shikov
authored andcommitted
React Native sync for revisions 2a7bb41...b8fda6c
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
1 parent 1cd9736 commit 10b9308

13 files changed

+743
-549
lines changed

Libraries/Renderer/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2a7bb4154809f1f4e17ffbdde1342bd4ce91ea37
1+
b8fda6cabc7efc53356d87c6516d6a3d7eb1253c

Libraries/Renderer/implementations/ReactFabric-dev.fb.js

+106-65
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<e849805d384d655a0b454ba748de33e0>>
10+
* @generated SignedSource<<8974e8c964125552d627281e52405ecc>>
1111
*/
1212

1313
'use strict';
@@ -2515,8 +2515,25 @@ var ReactFabricGlobalResponderHandler = {
25152515
fromOrToStateNode && fromOrToStateNode.canonical._internalInstanceHandle
25162516
);
25172517

2518-
if (isFabric);
2519-
else {
2518+
if (isFabric) {
2519+
if (from) {
2520+
// equivalent to clearJSResponder
2521+
nativeFabricUIManager.setIsJSResponder(
2522+
from.stateNode.node,
2523+
false,
2524+
blockNativeResponder || false
2525+
);
2526+
}
2527+
2528+
if (to) {
2529+
// equivalent to setJSResponder
2530+
nativeFabricUIManager.setIsJSResponder(
2531+
to.stateNode.node,
2532+
true,
2533+
blockNativeResponder || false
2534+
);
2535+
}
2536+
} else {
25202537
if (to !== null) {
25212538
var tag = to.stateNode.canonical._nativeTag;
25222539
ReactNativePrivateInterface.UIManager.setJSResponder(
@@ -2620,11 +2637,16 @@ function getIteratorFn(maybeIterable) {
26202637
}
26212638

26222639
function getWrappedName(outerType, innerType, wrapperName) {
2640+
var displayName = outerType.displayName;
2641+
2642+
if (displayName) {
2643+
return displayName;
2644+
}
2645+
26232646
var functionName = innerType.displayName || innerType.name || "";
2624-
return (
2625-
outerType.displayName ||
2626-
(functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName)
2627-
);
2647+
return functionName !== ""
2648+
? wrapperName + "(" + functionName + ")"
2649+
: wrapperName;
26282650
} // Keep in sync with react-reconciler/getComponentNameFromFiber
26292651

26302652
function getContextName(type) {
@@ -2640,7 +2662,7 @@ function getComponentNameFromType(type) {
26402662
{
26412663
if (typeof type.tag === "number") {
26422664
error(
2643-
"Received an unexpected object in getComponentName(). " +
2665+
"Received an unexpected object in getComponentNameFromType(). " +
26442666
"This is likely a bug in React. Please file an issue."
26452667
);
26462668
}
@@ -2691,7 +2713,13 @@ function getComponentNameFromType(type) {
26912713
return getWrappedName(type, type.render, "ForwardRef");
26922714

26932715
case REACT_MEMO_TYPE:
2694-
return getComponentNameFromType(type.type);
2716+
var outerName = type.displayName || null;
2717+
2718+
if (outerName !== null) {
2719+
return outerName;
2720+
}
2721+
2722+
return getComponentNameFromType(type.type) || "Memo";
26952723

26962724
case REACT_LAZY_TYPE: {
26972725
var lazyComponent = type;
@@ -4009,6 +4037,29 @@ function onCommitUnmount(fiber) {
40094037
}
40104038
}
40114039

4040+
var NoMode =
4041+
/* */
4042+
0; // TODO: Remove ConcurrentMode by reading from the root tag instead
4043+
4044+
var ConcurrentMode =
4045+
/* */
4046+
1;
4047+
var ProfileMode =
4048+
/* */
4049+
2;
4050+
var DebugTracingMode =
4051+
/* */
4052+
4;
4053+
var StrictLegacyMode =
4054+
/* */
4055+
8;
4056+
var StrictEffectsMode =
4057+
/* */
4058+
16;
4059+
var ConcurrentUpdatesByDefaultMode =
4060+
/* */
4061+
32;
4062+
40124063
// If those values are changed that package should be rebuilt and redeployed.
40134064

40144065
var TotalLanes = 31;
@@ -4260,6 +4311,15 @@ function getNextLanes(root, wipLanes) {
42604311
return wipLanes;
42614312
}
42624313
}
4314+
4315+
if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode);
4316+
else if ((nextLanes & InputContinuousLane) !== NoLanes) {
4317+
// When updates are sync by default, we entangle continuous priority updates
4318+
// and default updates, so they render in the same batch. The only reason
4319+
// they use separate lanes is because continuous updates should interrupt
4320+
// transitions, but default updates should not.
4321+
nextLanes |= pendingLanes & DefaultLane;
4322+
} // Check for entangled lanes and add them to the batch.
42634323
//
42644324
// A lane is said to be entangled with another when it's not allowed to render
42654325
// in a batch that does not also include the other lane. Typically we do this
@@ -4448,9 +4508,17 @@ function shouldTimeSlice(root, lanes) {
44484508
return false;
44494509
}
44504510

4451-
{
4511+
if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) {
4512+
// Concurrent updates by default always use time slicing.
44524513
return true;
44534514
}
4515+
4516+
var SyncDefaultLanes =
4517+
InputContinuousHydrationLane |
4518+
InputContinuousLane |
4519+
DefaultHydrationLane |
4520+
DefaultLane;
4521+
return (lanes & SyncDefaultLanes) === NoLanes;
44544522
}
44554523
function isTransitionLane(lane) {
44564524
return (lane & TransitionLanes) !== 0;
@@ -5744,27 +5812,7 @@ var Passive$1 =
57445812
/* */
57455813
4;
57465814

5747-
var ReactVersion = "17.0.3-2a7bb4154";
5748-
5749-
var NoMode =
5750-
/* */
5751-
0; // TODO: Remove ConcurrentMode by reading from the root tag instead
5752-
5753-
var ConcurrentMode =
5754-
/* */
5755-
1;
5756-
var ProfileMode =
5757-
/* */
5758-
2;
5759-
var DebugTracingMode =
5760-
/* */
5761-
4;
5762-
var StrictLegacyMode =
5763-
/* */
5764-
8;
5765-
var StrictEffectsMode =
5766-
/* */
5767-
16;
5815+
var ReactVersion = "17.0.3-b8fda6cab";
57685816

57695817
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
57705818
var NoTransition = 0;
@@ -10148,7 +10196,12 @@ function renderWithHooks(
1014810196

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

2109321146
return workInProgress;
2109421147
}
21095-
function createHostRootFiber(tag, strictModeLevelOverride) {
21148+
function createHostRootFiber(
21149+
tag,
21150+
isStrictMode,
21151+
concurrentUpdatesByDefaultOverride
21152+
) {
2109621153
var mode;
2109721154

2109821155
if (tag === ConcurrentRoot) {
2109921156
mode = ConcurrentMode;
2110021157

21101-
if (strictModeLevelOverride !== null) {
21102-
if (strictModeLevelOverride >= 1) {
21103-
mode |= StrictLegacyMode;
21104-
}
21158+
if (isStrictMode === true) {
21159+
mode |= StrictLegacyMode;
2110521160

2110621161
{
21107-
if (strictModeLevelOverride >= 2) {
21108-
mode |= StrictEffectsMode;
21109-
}
21110-
}
21111-
} else {
21112-
{
21113-
mode |= StrictLegacyMode;
21162+
mode |= StrictEffectsMode;
2111421163
}
2111521164
}
21165+
21166+
{
21167+
mode |= ConcurrentUpdatesByDefaultMode;
21168+
}
2111621169
} else {
2111721170
mode = NoMode;
2111821171
}
@@ -21163,22 +21216,8 @@ function createFiberFromTypeAndProps(
2116321216
break;
2116421217

2116521218
case REACT_STRICT_MODE_TYPE:
21166-
fiberTag = Mode; // Legacy strict mode (<StrictMode> without any level prop) defaults to level 1.
21167-
21168-
var level =
21169-
pendingProps.unstable_level == null ? 1 : pendingProps.unstable_level; // Levels cascade; higher levels inherit all lower level modes.
21170-
// It is explicitly not supported to lower a mode with nesting, only to increase it.
21171-
21172-
if (level >= 1) {
21173-
mode |= StrictLegacyMode;
21174-
}
21175-
21176-
{
21177-
if (level >= 2) {
21178-
mode |= StrictEffectsMode;
21179-
}
21180-
}
21181-
21219+
fiberTag = Mode;
21220+
mode |= StrictLegacyMode | StrictEffectsMode;
2118221221
break;
2118321222

2118421223
case REACT_PROFILER_TYPE:
@@ -21470,12 +21509,13 @@ function createFiberRoot(
2147021509
tag,
2147121510
hydrate,
2147221511
hydrationCallbacks,
21473-
strictModeLevelOverride
21512+
isStrictMode,
21513+
concurrentUpdatesByDefaultOverride
2147421514
) {
2147521515
var root = new FiberRootNode(containerInfo, tag, hydrate);
2147621516
// stateNode is any.
2147721517

21478-
var uninitializedFiber = createHostRootFiber(tag, strictModeLevelOverride);
21518+
var uninitializedFiber = createHostRootFiber(tag, isStrictMode);
2147921519
root.current = uninitializedFiber;
2148021520
uninitializedFiber.stateNode = root;
2148121521

@@ -21613,14 +21653,15 @@ function createContainer(
2161321653
tag,
2161421654
hydrate,
2161521655
hydrationCallbacks,
21616-
strictModeLevelOverride
21656+
isStrictMode,
21657+
concurrentUpdatesByDefaultOverride
2161721658
) {
2161821659
return createFiberRoot(
2161921660
containerInfo,
2162021661
tag,
2162121662
hydrate,
2162221663
hydrationCallbacks,
21623-
strictModeLevelOverride
21664+
isStrictMode
2162421665
);
2162521666
}
2162621667
function updateContainer(element, container, parentComponent, callback) {
@@ -22385,7 +22426,7 @@ function render(element, containerTag, callback) {
2238522426
if (!root) {
2238622427
// TODO (bvaughn): If we decide to keep the wrapper component,
2238722428
// We could create a wrapper for containerTag as well to reduce special casing.
22388-
root = createContainer(containerTag, LegacyRoot, false, null, null);
22429+
root = createContainer(containerTag, LegacyRoot, false, null, false);
2238922430
roots.set(containerTag, root);
2239022431
}
2239122432

0 commit comments

Comments
 (0)