@@ -2,6 +2,7 @@ import React, { Component, PropTypes } from 'react';
2
2
import invariant from 'invariant' ;
3
3
import sizeMe from 'react-sizeme' ;
4
4
import mergeWith from './utils/mergeWith' ;
5
+ import getDisplayName from './utils/getDisplayName' ;
5
6
6
7
const defaultSizeMeConfig = {
7
8
monitorHeight : false ,
@@ -57,6 +58,15 @@ function componentQueries(...params) {
57
58
58
59
return function WrapComponent ( WrappedComponent ) {
59
60
class ComponentWithComponentQueries extends Component {
61
+ static displayName = `ComponentQueries(${ getDisplayName ( WrappedComponent ) } )` ;
62
+
63
+ static propTypes = {
64
+ size : PropTypes . shape ( {
65
+ width : PropTypes . number ,
66
+ height : PropTypes . number ,
67
+ } ) . isRequired ,
68
+ } ;
69
+
60
70
state = {
61
71
queryResult : { } ,
62
72
}
@@ -97,26 +107,23 @@ function componentQueries(...params) {
97
107
}
98
108
99
109
render ( ) {
100
- const { size, ...otherProps } = this . props ; // eslint-disable-line no-unused-vars
110
+ const {
111
+ size, // eslint-disable-line no-unused-vars
112
+ ...otherProps ,
113
+ } = this . props ;
101
114
102
115
const allProps = mergeWith (
103
116
this . state . queryResult ,
104
117
otherProps ,
105
- mergeWithCustomizer ) ;
118
+ mergeWithCustomizer
119
+ ) ;
106
120
107
121
return (
108
122
< WrappedComponent { ...allProps } />
109
123
) ;
110
124
}
111
125
}
112
126
113
- ComponentWithComponentQueries . propTypes = {
114
- size : PropTypes . shape ( {
115
- width : PropTypes . number ,
116
- height : PropTypes . number ,
117
- } ) . isRequired ,
118
- } ;
119
-
120
127
return sizeMe ( sizeMeConfig ) ( ComponentWithComponentQueries ) ;
121
128
} ;
122
129
}
0 commit comments