1851818518 */
1851918519 componentWillUnmount: 'DEFINE_MANY',
1852018520
18521+ /**
18522+ * Replacement for (deprecated) `componentWillMount`.
18523+ *
18524+ * @optional
18525+ */
18526+ UNSAFE_componentWillMount: 'DEFINE_MANY',
18527+
18528+ /**
18529+ * Replacement for (deprecated) `componentWillReceiveProps`.
18530+ *
18531+ * @optional
18532+ */
18533+ UNSAFE_componentWillReceiveProps: 'DEFINE_MANY',
18534+
18535+ /**
18536+ * Replacement for (deprecated) `componentWillUpdate`.
18537+ *
18538+ * @optional
18539+ */
18540+ UNSAFE_componentWillUpdate: 'DEFINE_MANY',
18541+
1852118542 // ==== Advanced methods ====
1852218543
1852318544 /**
1853318554 updateComponent: 'OVERRIDE_BASE'
1853418555 };
1853518556
18557+ /**
18558+ * Similar to ReactClassInterface but for static methods.
18559+ */
18560+ var ReactClassStaticInterface = {
18561+ /**
18562+ * This method is invoked after a component is instantiated and when it
18563+ * receives new props. Return an object to update state in response to
18564+ * prop changes. Return null to indicate no change to state.
18565+ *
18566+ * If an object is returned, its keys will be merged into the existing state.
18567+ *
18568+ * @return {object || null}
18569+ * @optional
18570+ */
18571+ getDerivedStateFromProps: 'DEFINE_MANY_MERGED'
18572+ };
18573+
1853618574 /**
1853718575 * Mapping from class specification keys to special processing functions.
1853818576 *
1876718805 if (!statics) {
1876818806 return;
1876918807 }
18808+
1877018809 for (var name in statics) {
1877118810 var property = statics[name];
1877218811 if (!statics.hasOwnProperty(name)) {
@@ -18783,14 +18822,25 @@
1878318822 name
1878418823 );
1878518824
18786- var isInherited = name in Constructor;
18787- _invariant(
18788- !isInherited,
18789- 'ReactClass: You are attempting to define ' +
18790- '`%s` on your component more than once. This conflict may be ' +
18791- 'due to a mixin.',
18792- name
18793- );
18825+ var isAlreadyDefined = name in Constructor;
18826+ if (isAlreadyDefined) {
18827+ var specPolicy = ReactClassStaticInterface.hasOwnProperty(name)
18828+ ? ReactClassStaticInterface[name]
18829+ : null;
18830+
18831+ _invariant(
18832+ specPolicy === 'DEFINE_MANY_MERGED',
18833+ 'ReactClass: You are attempting to define ' +
18834+ '`%s` on your component more than once. This conflict may be ' +
18835+ 'due to a mixin.',
18836+ name
18837+ );
18838+
18839+ Constructor[name] = createMergedResultFunction(Constructor[name], property);
18840+
18841+ return;
18842+ }
18843+
1879418844 Constructor[name] = property;
1879518845 }
1879618846 }
1910019150 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
1910119151 spec.displayName || 'A component'
1910219152 );
19153+ warning(
19154+ !Constructor.prototype.UNSAFE_componentWillRecieveProps,
19155+ '%s has a method called UNSAFE_componentWillRecieveProps(). ' +
19156+ 'Did you mean UNSAFE_componentWillReceiveProps()?',
19157+ spec.displayName || 'A component'
19158+ );
1910319159 }
1910419160
1910519161 // Reduce time spent doing lookups by setting these on the prototype.
0 commit comments