When proxying statics functions, copy properties
Port of 076047012a
which went in
externally before ReactLegacyDescriptor happened, so it needed to be
ported.
This commit is contained in:
parent
23c5332208
commit
de711efcc9
|
@ -34,7 +34,15 @@ function proxyStaticMethods(target, source) {
|
|||
if (source.hasOwnProperty(key)) {
|
||||
var value = source[key];
|
||||
if (typeof value === 'function') {
|
||||
target[key] = value.bind(source);
|
||||
var bound = value.bind(source);
|
||||
// Copy any properties defined on the function, such as `isRequired` on
|
||||
// a PropTypes validator. (mergeInto refuses to work on functions.)
|
||||
for (var k in value) {
|
||||
if (value.hasOwnProperty(k)) {
|
||||
bound[k] = value[k];
|
||||
}
|
||||
}
|
||||
target[key] = bound;
|
||||
} else {
|
||||
target[key] = value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue