Skip to content

Commit 1cfd770

Browse files
committed
Remove React.createFactory (#27798)
`React.createFactory` has been long deprecated. This removes it for the next release. DiffTrain build for commit 2aed507.
1 parent 2eb1b51 commit 1cfd770

File tree

3 files changed

+40
-91
lines changed

3 files changed

+40
-91
lines changed

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

+2-47
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<ba8e03c28352119146c3eb29b5683ded>>
10+
* @generated SignedSource<<3c9d3cbcbb7690bdd3c319e0ba24e0a8>>
1111
*/
1212

1313
"use strict";
@@ -26,7 +26,7 @@ if (__DEV__) {
2626
}
2727
var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags");
2828

29-
var ReactVersion = "19.0.0-canary-66632b76";
29+
var ReactVersion = "19.0.0-canary-d53f813c";
3030

3131
// ATTENTION
3232
// When adding new symbols to this file,
@@ -1825,50 +1825,6 @@ if (__DEV__) {
18251825

18261826
return element;
18271827
}
1828-
var didWarnAboutDeprecatedCreateFactory = false;
1829-
/**
1830-
* Return a function that produces ReactElements of a given type.
1831-
* See https://reactjs.org/docs/react-api.html#createfactory
1832-
*/
1833-
1834-
function createFactory(type) {
1835-
var factory = createElement.bind(null, type); // Expose the type on the factory and the prototype so that it can be
1836-
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
1837-
// This should not be named `constructor` since this may not be the function
1838-
// that created the element, and it may not even be a constructor.
1839-
// Legacy hook: remove it
1840-
1841-
factory.type = type;
1842-
1843-
{
1844-
if (!didWarnAboutDeprecatedCreateFactory) {
1845-
didWarnAboutDeprecatedCreateFactory = true;
1846-
1847-
warn(
1848-
"React.createFactory() is deprecated and will be removed in " +
1849-
"a future major release. Consider using JSX " +
1850-
"or use React.createElement() directly instead."
1851-
);
1852-
} // Legacy hook: remove it
1853-
1854-
Object.defineProperty(factory, "type", {
1855-
enumerable: false,
1856-
get: function () {
1857-
warn(
1858-
"Factory.type is deprecated. Access the class directly " +
1859-
"before passing it to createFactory."
1860-
);
1861-
1862-
Object.defineProperty(this, "type", {
1863-
value: type
1864-
});
1865-
return type;
1866-
}
1867-
});
1868-
}
1869-
1870-
return factory;
1871-
}
18721828
function cloneAndReplaceKey(oldElement, newKey) {
18731829
return ReactElement(
18741830
oldElement.type,
@@ -3673,7 +3629,6 @@ if (__DEV__) {
36733629
exports.cloneElement = cloneElement;
36743630
exports.createContext = createContext;
36753631
exports.createElement = createElement;
3676-
exports.createFactory = createFactory;
36773632
exports.createRef = createRef;
36783633
exports.experimental_useEffectEvent = useEffectEvent;
36793634
exports.forwardRef = forwardRef;

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

+37-43
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<ac6e1c721cd9e734454c18870d36b509>>
10+
* @generated SignedSource<<ed4da00dc7705121a507bffa64d7f8bb>>
1111
*/
1212

1313
"use strict";
@@ -133,42 +133,6 @@ function jsxProd(type, config, maybeKey) {
133133
props
134134
);
135135
}
136-
function createElement(type, config, children) {
137-
var propName,
138-
props = {},
139-
key = null,
140-
ref = null;
141-
if (null != config)
142-
for (propName in (void 0 !== config.ref && (ref = config.ref),
143-
void 0 !== config.key && (key = "" + config.key),
144-
config))
145-
hasOwnProperty.call(config, propName) &&
146-
"key" !== propName &&
147-
"ref" !== propName &&
148-
"__self" !== propName &&
149-
"__source" !== propName &&
150-
(props[propName] = config[propName]);
151-
var childrenLength = arguments.length - 2;
152-
if (1 === childrenLength) props.children = children;
153-
else if (1 < childrenLength) {
154-
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
155-
childArray[i] = arguments[i + 2];
156-
props.children = childArray;
157-
}
158-
if (type && type.defaultProps)
159-
for (propName in ((childrenLength = type.defaultProps), childrenLength))
160-
void 0 === props[propName] &&
161-
(props[propName] = childrenLength[propName]);
162-
return ReactElement(
163-
type,
164-
key,
165-
ref,
166-
void 0,
167-
void 0,
168-
ReactCurrentOwner.current,
169-
props
170-
);
171-
}
172136
function cloneAndReplaceKey(oldElement, newKey) {
173137
return ReactElement(
174138
oldElement.type,
@@ -508,11 +472,41 @@ exports.createContext = function (defaultValue) {
508472
(defaultValue.Consumer = defaultValue));
509473
return defaultValue;
510474
};
511-
exports.createElement = createElement;
512-
exports.createFactory = function (type) {
513-
var factory = createElement.bind(null, type);
514-
factory.type = type;
515-
return factory;
475+
exports.createElement = function (type, config, children) {
476+
var propName,
477+
props = {},
478+
key = null,
479+
ref = null;
480+
if (null != config)
481+
for (propName in (void 0 !== config.ref && (ref = config.ref),
482+
void 0 !== config.key && (key = "" + config.key),
483+
config))
484+
hasOwnProperty.call(config, propName) &&
485+
"key" !== propName &&
486+
"ref" !== propName &&
487+
"__self" !== propName &&
488+
"__source" !== propName &&
489+
(props[propName] = config[propName]);
490+
var childrenLength = arguments.length - 2;
491+
if (1 === childrenLength) props.children = children;
492+
else if (1 < childrenLength) {
493+
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
494+
childArray[i] = arguments[i + 2];
495+
props.children = childArray;
496+
}
497+
if (type && type.defaultProps)
498+
for (propName in ((childrenLength = type.defaultProps), childrenLength))
499+
void 0 === props[propName] &&
500+
(props[propName] = childrenLength[propName]);
501+
return ReactElement(
502+
type,
503+
key,
504+
ref,
505+
void 0,
506+
void 0,
507+
ReactCurrentOwner.current,
508+
props
509+
);
516510
};
517511
exports.createRef = function () {
518512
return { current: null };
@@ -663,4 +657,4 @@ exports.useSyncExternalStore = function (
663657
exports.useTransition = function () {
664658
return ReactCurrentDispatcher.current.useTransition();
665659
};
666-
exports.version = "19.0.0-canary-bd294150";
660+
exports.version = "19.0.0-canary-a9f85346";
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
425f72bdd4263dcaba829cf52545309bbfde56b4
1+
2aed507a76a0b1524426c398897cbe47d80c51e5

0 commit comments

Comments
 (0)