Skip to content

Commit 96ce55d

Browse files
committed
Use a constant HostContext in prod builds for Fabric renderer (#29888)
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. Before submitting a pull request, please make sure the following is done: 1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`. 2. Run `yarn` in the repository root. 3. If you've fixed a bug or added code that should be tested, add tests! 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`. 6. If you need a debugger, run `yarn test --debug --watch TestName`, open `chrome://inspect`, and press "Inspect". 7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`). 8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files. 9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`). 10. If you haven't already, complete the CLA. Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html --> ## Summary <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> In the Fabric renderer in React Native, we only use the HostContext to issue soft errors in __DEV__ bundles when attempting to add a raw text child to a node that may not support them. Moving the logic to set this context to __DEV__ bundles only unblocks more expensive methods for resolving whether a parent context supports raw text children, like resolving this information from `getViewConfigForType`. ## How did you test this change? <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. How exactly did you verify that your PR solves the issue you wanted to solve? If you leave this empty, your PR will very likely be closed. --> yarn test (--prod) DiffTrain build for commit 3154ec8.
1 parent 19a6337 commit 96ce55d

File tree

14 files changed

+104
-125
lines changed

14 files changed

+104
-125
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-native-fb-195d5bb99e-20240612
1+
19.0.0-native-fb-3154ec8a38-20240614

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<6cdcb413108c1e621ba982c74574c360>>
10+
* @generated SignedSource<<0907a7cf7bb18ca353544d071f3fabbb>>
1111
*/
1212

1313
"use strict";
@@ -15053,14 +15053,14 @@ __DEV__ &&
1505315053
scheduleRoot: scheduleRoot,
1505415054
setRefreshHandler: setRefreshHandler,
1505515055
getCurrentFiber: getCurrentFiberForDevTools,
15056-
reconcilerVersion: "19.0.0-native-fb-195d5bb99e-20240612"
15056+
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
1505715057
});
1505815058
})({
1505915059
findFiberByHostInstance: function () {
1506015060
throw Error("TestRenderer does not support findFiberByHostInstance()");
1506115061
},
1506215062
bundleType: 1,
15063-
version: "19.0.0-native-fb-195d5bb99e-20240612",
15063+
version: "19.0.0-native-fb-3154ec8a38-20240614",
1506415064
rendererPackageName: "react-test-renderer"
1506515065
});
1506615066
exports._Scheduler = Scheduler;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<26761dd87498d30bb9190a1d55c61aee>>
10+
* @generated SignedSource<<37e432939784feeb91ab06f90f2e34a1>>
1111
*/
1212

1313
"use strict";
@@ -9357,7 +9357,7 @@ var devToolsConfig$jscomp$inline_1063 = {
93579357
throw Error("TestRenderer does not support findFiberByHostInstance()");
93589358
},
93599359
bundleType: 0,
9360-
version: "19.0.0-native-fb-195d5bb99e-20240612",
9360+
version: "19.0.0-native-fb-3154ec8a38-20240614",
93619361
rendererPackageName: "react-test-renderer"
93629362
};
93639363
var internals$jscomp$inline_1250 = {
@@ -9388,7 +9388,7 @@ var internals$jscomp$inline_1250 = {
93889388
scheduleRoot: null,
93899389
setRefreshHandler: null,
93909390
getCurrentFiber: null,
9391-
reconcilerVersion: "19.0.0-native-fb-195d5bb99e-20240612"
9391+
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
93929392
};
93939393
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
93949394
var hook$jscomp$inline_1251 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f35fce92640f481c9eb6cc29117627aa>>
10+
* @generated SignedSource<<4c4d5bb912d188af2305f4d02b06fa1f>>
1111
*/
1212

1313
"use strict";
@@ -9979,7 +9979,7 @@ var devToolsConfig$jscomp$inline_1146 = {
99799979
throw Error("TestRenderer does not support findFiberByHostInstance()");
99809980
},
99819981
bundleType: 0,
9982-
version: "19.0.0-native-fb-195d5bb99e-20240612",
9982+
version: "19.0.0-native-fb-3154ec8a38-20240614",
99839983
rendererPackageName: "react-test-renderer"
99849984
};
99859985
(function (internals) {
@@ -10023,7 +10023,7 @@ var devToolsConfig$jscomp$inline_1146 = {
1002310023
scheduleRoot: null,
1002410024
setRefreshHandler: null,
1002510025
getCurrentFiber: null,
10026-
reconcilerVersion: "19.0.0-native-fb-195d5bb99e-20240612"
10026+
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
1002710027
});
1002810028
exports._Scheduler = Scheduler;
1002910029
exports.act = act;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<d7ecd32a61474d852e2d40cc1ec28c08>>
10+
* @generated SignedSource<<0e9df63c84b477edf49937a2b291acfa>>
1111
*/
1212

1313
"use strict";
@@ -1741,7 +1741,7 @@ __DEV__ &&
17411741
exports.useTransition = function () {
17421742
return resolveDispatcher().useTransition();
17431743
};
1744-
exports.version = "19.0.0-native-fb-195d5bb99e-20240612";
1744+
exports.version = "19.0.0-native-fb-3154ec8a38-20240614";
17451745
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
17461746
"function" ===
17471747
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5a4093ad1666047336503aabe558d5a1>>
10+
* @generated SignedSource<<7fe71450c3e9debfe25049ec1c126ee7>>
1111
*/
1212

1313
"use strict";
@@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.0.0-native-fb-195d5bb99e-20240612";
607+
exports.version = "19.0.0-native-fb-3154ec8a38-20240614";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<31516b8c299906006f335595e835e19c>>
10+
* @generated SignedSource<<2fd92cafc9359f2f83c500e52e638764>>
1111
*/
1212

1313
"use strict";
@@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
608608
exports.useTransition = function () {
609609
return ReactSharedInternals.H.useTransition();
610610
};
611-
exports.version = "19.0.0-native-fb-195d5bb99e-20240612";
611+
exports.version = "19.0.0-native-fb-3154ec8a38-20240614";
612612
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
613613
"function" ===
614614
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
195d5bb99e366889f0905779a0f9432d1624f999
1+
3154ec8a38e6014090039be54e0ca597fa967fdd

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<eeb59a95e0ff79fdae2370e89d593d60>>
10+
* @generated SignedSource<<1fcc339b6f0c14225ef7ab3bb10f13f0>>
1111
*/
1212

1313
"use strict";
@@ -2165,8 +2165,9 @@ __DEV__ &&
21652165
push(rootInstanceStackCursor, nextRootInstance, fiber);
21662166
push(contextFiberStackCursor, fiber, fiber);
21672167
push(contextStackCursor, null, fiber);
2168+
nextRootInstance = { isInAParentText: !1 };
21682169
pop(contextStackCursor, fiber);
2169-
push(contextStackCursor, { isInAParentText: !1 }, fiber);
2170+
push(contextStackCursor, nextRootInstance, fiber);
21702171
}
21712172
function popHostContainer(fiber) {
21722173
pop(contextStackCursor, fiber);
@@ -16685,12 +16686,12 @@ __DEV__ &&
1668516686
scheduleRoot: scheduleRoot,
1668616687
setRefreshHandler: setRefreshHandler,
1668716688
getCurrentFiber: getCurrentFiberForDevTools,
16688-
reconcilerVersion: "19.0.0-native-fb-195d5bb99e-20240612"
16689+
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
1668916690
});
1669016691
})({
1669116692
findFiberByHostInstance: getInstanceFromNode,
1669216693
bundleType: 1,
16693-
version: "19.0.0-native-fb-195d5bb99e-20240612",
16694+
version: "19.0.0-native-fb-3154ec8a38-20240614",
1669416695
rendererPackageName: "react-native-renderer",
1669516696
rendererConfig: {
1669616697
getInspectorDataForInstance: getInspectorDataForInstance,

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<dd1d99273d865e111317ed207a95e790>>
10+
* @generated SignedSource<<61089681f3a7b4551020050cddea9814>>
1111
*/
1212

1313
"use strict";
@@ -1224,7 +1224,7 @@ eventPluginOrder = Array.prototype.slice.call([
12241224
"ReactNativeBridgeEventPlugin"
12251225
]);
12261226
recomputePluginOrdering();
1227-
var injectedNamesToPlugins$jscomp$inline_285 = {
1227+
var injectedNamesToPlugins$jscomp$inline_284 = {
12281228
ResponderEventPlugin: ResponderEventPlugin,
12291229
ReactNativeBridgeEventPlugin: {
12301230
eventTypes: {},
@@ -1270,32 +1270,32 @@ var injectedNamesToPlugins$jscomp$inline_285 = {
12701270
}
12711271
}
12721272
},
1273-
isOrderingDirty$jscomp$inline_286 = !1,
1274-
pluginName$jscomp$inline_287;
1275-
for (pluginName$jscomp$inline_287 in injectedNamesToPlugins$jscomp$inline_285)
1273+
isOrderingDirty$jscomp$inline_285 = !1,
1274+
pluginName$jscomp$inline_286;
1275+
for (pluginName$jscomp$inline_286 in injectedNamesToPlugins$jscomp$inline_284)
12761276
if (
1277-
injectedNamesToPlugins$jscomp$inline_285.hasOwnProperty(
1278-
pluginName$jscomp$inline_287
1277+
injectedNamesToPlugins$jscomp$inline_284.hasOwnProperty(
1278+
pluginName$jscomp$inline_286
12791279
)
12801280
) {
1281-
var pluginModule$jscomp$inline_288 =
1282-
injectedNamesToPlugins$jscomp$inline_285[pluginName$jscomp$inline_287];
1281+
var pluginModule$jscomp$inline_287 =
1282+
injectedNamesToPlugins$jscomp$inline_284[pluginName$jscomp$inline_286];
12831283
if (
1284-
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_287) ||
1285-
namesToPlugins[pluginName$jscomp$inline_287] !==
1286-
pluginModule$jscomp$inline_288
1284+
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_286) ||
1285+
namesToPlugins[pluginName$jscomp$inline_286] !==
1286+
pluginModule$jscomp$inline_287
12871287
) {
1288-
if (namesToPlugins[pluginName$jscomp$inline_287])
1288+
if (namesToPlugins[pluginName$jscomp$inline_286])
12891289
throw Error(
12901290
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
1291-
(pluginName$jscomp$inline_287 + "`.")
1291+
(pluginName$jscomp$inline_286 + "`.")
12921292
);
1293-
namesToPlugins[pluginName$jscomp$inline_287] =
1294-
pluginModule$jscomp$inline_288;
1295-
isOrderingDirty$jscomp$inline_286 = !0;
1293+
namesToPlugins[pluginName$jscomp$inline_286] =
1294+
pluginModule$jscomp$inline_287;
1295+
isOrderingDirty$jscomp$inline_285 = !0;
12961296
}
12971297
}
1298-
isOrderingDirty$jscomp$inline_286 && recomputePluginOrdering();
1298+
isOrderingDirty$jscomp$inline_285 && recomputePluginOrdering();
12991299
var emptyObject$1 = {},
13001300
removedKeys = null,
13011301
removedKeyCount = 0,
@@ -1908,6 +1908,7 @@ var _nativeFabricUIManage = nativeFabricUIManager,
19081908
ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get,
19091909
nextReactTag = 2;
19101910
registerEventHandler && registerEventHandler(dispatchEvent);
1911+
var PROD_HOST_CONTEXT = { isInAParentText: !0 };
19111912
function createTextInstance(
19121913
text,
19131914
rootContainerInstance,
@@ -2232,7 +2233,7 @@ function pushHostContainer(fiber, nextRootInstance) {
22322233
push(contextFiberStackCursor, fiber);
22332234
push(contextStackCursor, null);
22342235
pop(contextStackCursor);
2235-
push(contextStackCursor, { isInAParentText: !1 });
2236+
push(contextStackCursor, PROD_HOST_CONTEXT);
22362237
}
22372238
function popHostContainer() {
22382239
pop(contextStackCursor);
@@ -2242,20 +2243,8 @@ function popHostContainer() {
22422243
function pushHostContext(fiber) {
22432244
null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber);
22442245
var context = contextStackCursor.current;
2245-
var JSCompiler_inline_result = fiber.type;
2246-
JSCompiler_inline_result =
2247-
"AndroidTextInput" === JSCompiler_inline_result ||
2248-
"RCTMultilineTextInputView" === JSCompiler_inline_result ||
2249-
"RCTSinglelineTextInputView" === JSCompiler_inline_result ||
2250-
"RCTText" === JSCompiler_inline_result ||
2251-
"RCTVirtualText" === JSCompiler_inline_result;
2252-
JSCompiler_inline_result =
2253-
context.isInAParentText !== JSCompiler_inline_result
2254-
? { isInAParentText: JSCompiler_inline_result }
2255-
: context;
2256-
context !== JSCompiler_inline_result &&
2257-
(push(contextFiberStackCursor, fiber),
2258-
push(contextStackCursor, JSCompiler_inline_result));
2246+
context !== context &&
2247+
(push(contextFiberStackCursor, fiber), push(contextStackCursor, context));
22592248
}
22602249
function popHostContext(fiber) {
22612250
contextFiberStackCursor.current === fiber &&
@@ -10609,10 +10598,10 @@ batchedUpdatesImpl = function (fn, a) {
1060910598
}
1061010599
};
1061110600
var roots = new Map(),
10612-
devToolsConfig$jscomp$inline_1142 = {
10601+
devToolsConfig$jscomp$inline_1136 = {
1061310602
findFiberByHostInstance: getInstanceFromNode,
1061410603
bundleType: 0,
10615-
version: "19.0.0-native-fb-195d5bb99e-20240612",
10604+
version: "19.0.0-native-fb-3154ec8a38-20240614",
1061610605
rendererPackageName: "react-native-renderer",
1061710606
rendererConfig: {
1061810607
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10628,11 +10617,11 @@ var roots = new Map(),
1062810617
}.bind(null, findNodeHandle)
1062910618
}
1063010619
};
10631-
var internals$jscomp$inline_1368 = {
10632-
bundleType: devToolsConfig$jscomp$inline_1142.bundleType,
10633-
version: devToolsConfig$jscomp$inline_1142.version,
10634-
rendererPackageName: devToolsConfig$jscomp$inline_1142.rendererPackageName,
10635-
rendererConfig: devToolsConfig$jscomp$inline_1142.rendererConfig,
10620+
var internals$jscomp$inline_1362 = {
10621+
bundleType: devToolsConfig$jscomp$inline_1136.bundleType,
10622+
version: devToolsConfig$jscomp$inline_1136.version,
10623+
rendererPackageName: devToolsConfig$jscomp$inline_1136.rendererPackageName,
10624+
rendererConfig: devToolsConfig$jscomp$inline_1136.rendererConfig,
1063610625
overrideHookState: null,
1063710626
overrideHookStateDeletePath: null,
1063810627
overrideHookStateRenamePath: null,
@@ -10648,26 +10637,26 @@ var internals$jscomp$inline_1368 = {
1064810637
return null === fiber ? null : fiber.stateNode;
1064910638
},
1065010639
findFiberByHostInstance:
10651-
devToolsConfig$jscomp$inline_1142.findFiberByHostInstance ||
10640+
devToolsConfig$jscomp$inline_1136.findFiberByHostInstance ||
1065210641
emptyFindFiberByHostInstance,
1065310642
findHostInstancesForRefresh: null,
1065410643
scheduleRefresh: null,
1065510644
scheduleRoot: null,
1065610645
setRefreshHandler: null,
1065710646
getCurrentFiber: null,
10658-
reconcilerVersion: "19.0.0-native-fb-195d5bb99e-20240612"
10647+
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
1065910648
};
1066010649
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
10661-
var hook$jscomp$inline_1369 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
10650+
var hook$jscomp$inline_1363 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1066210651
if (
10663-
!hook$jscomp$inline_1369.isDisabled &&
10664-
hook$jscomp$inline_1369.supportsFiber
10652+
!hook$jscomp$inline_1363.isDisabled &&
10653+
hook$jscomp$inline_1363.supportsFiber
1066510654
)
1066610655
try {
10667-
(rendererID = hook$jscomp$inline_1369.inject(
10668-
internals$jscomp$inline_1368
10656+
(rendererID = hook$jscomp$inline_1363.inject(
10657+
internals$jscomp$inline_1362
1066910658
)),
10670-
(injectedHook = hook$jscomp$inline_1369);
10659+
(injectedHook = hook$jscomp$inline_1363);
1067110660
} catch (err) {}
1067210661
}
1067310662
exports.createPortal = function (children, containerTag) {

0 commit comments

Comments
 (0)