Use concurrent root in RTR (#28498)

Based on
- https://github.com/facebook/react/pull/28497
- https://github.com/facebook/react/pull/28419

Reusing the disableLegacyMode flag, we set ReactTestRenderer to always
render with concurrent root where legacy APIs are no longer available.
If disableLegacyMode is false, we continue to allow the
unstable_isConcurrent option determine the root type.

Also checking a global `IS_REACT_NATIVE_TEST_ENVIRONMENT` so we can
maintain the existing behavior for RN until we remove legacy root
support there.

DiffTrain build for [bb66aa3cef](https://github.com/facebook/react/commit/bb66aa3cef4e42aee790200d03cf7a82659da121)
This commit is contained in:
jackpope
2024-03-26 22:57:58 +00:00
parent 71cc6ab810
commit 34ee899fef
3 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -1 +1 @@
84c84d72f11ff1961a103b3cd59919876e48f759
bb66aa3cef4e42aee790200d03cf7a82659da121
@@ -144,6 +144,7 @@ if (__DEV__) {
var enableLegacyHidden = false;
var enableAsyncActions = true;
var alwaysThrottleRetries = true;
var disableLegacyMode = false;
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -26108,7 +26109,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "19.0.0-www-classic-4c1f5e46";
var ReactVersion = "19.0.0-www-classic-ac0f08bc";
// Might add PROFILE later.
@@ -27002,7 +27003,8 @@ if (__DEV__) {
function create(element, options) {
var createNodeMock = defaultTestOptions.createNodeMock;
var isConcurrent = false;
var isConcurrentOnly = disableLegacyMode === true;
var isConcurrent = isConcurrentOnly;
var isStrictMode = false;
var concurrentUpdatesByDefault = null;
@@ -27012,8 +27014,8 @@ if (__DEV__) {
createNodeMock = options.createNodeMock;
}
if (options.unstable_isConcurrent === true) {
isConcurrent = true;
{
isConcurrent = options.unstable_isConcurrent;
}
if (options.unstable_strictMode === true) {
@@ -144,6 +144,7 @@ if (__DEV__) {
var enableLegacyHidden = false;
var enableAsyncActions = true;
var alwaysThrottleRetries = true;
var disableLegacyMode = false;
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -26108,7 +26109,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "19.0.0-www-modern-4c1f5e46";
var ReactVersion = "19.0.0-www-modern-ac0f08bc";
// Might add PROFILE later.
@@ -27002,7 +27003,8 @@ if (__DEV__) {
function create(element, options) {
var createNodeMock = defaultTestOptions.createNodeMock;
var isConcurrent = false;
var isConcurrentOnly = disableLegacyMode === true;
var isConcurrent = isConcurrentOnly;
var isStrictMode = false;
var concurrentUpdatesByDefault = null;
@@ -27012,8 +27014,8 @@ if (__DEV__) {
createNodeMock = options.createNodeMock;
}
if (options.unstable_isConcurrent === true) {
isConcurrent = true;
{
isConcurrent = options.unstable_isConcurrent;
}
if (options.unstable_strictMode === true) {