1
+ import reactCreateClass from "./react-create-class" ;
1
2
import React from "react" ;
2
3
import Globalize from "globalize" ;
3
4
@@ -22,18 +23,15 @@ function generator(fn, localPropNames, options) {
22
23
} ;
23
24
var globalizePropNames = commonPropNames . concat ( localPropNames ) ;
24
25
25
- return class extends React . Component {
26
- //static displayName = Fn;
27
-
28
- componentWillMount ( ) {
26
+ return reactCreateClass ( {
27
+ displayName : Fn ,
28
+ componentWillMount : function ( ) {
29
29
this . setup ( this . props ) ;
30
- }
31
-
32
- componentWillReceiveProps ( nextProps ) {
30
+ } ,
31
+ componentWillReceiveProps : function ( nextProps ) {
33
32
this . setup ( nextProps ) ;
34
- }
35
-
36
- setup ( props ) {
33
+ } ,
34
+ setup : function ( props ) {
37
35
this . globalize = props . locale ? Globalize ( props . locale ) : Globalize ;
38
36
this . domProps = Object . keys ( props ) . filter ( omit ( globalizePropNames ) ) . reduce ( function ( memo , propKey ) {
39
37
memo [ propKey ] = props [ propKey ] ;
@@ -48,12 +46,11 @@ function generator(fn, localPropNames, options) {
48
46
beforeFormat . call ( this , props ) ;
49
47
var formattedValue = this . globalize [ fn ] . apply ( this . globalize , this . globalizePropValues ) ;
50
48
this . value = afterFormat . call ( this , formattedValue ) ;
51
- }
52
-
53
- render ( ) {
49
+ } ,
50
+ render : function ( ) {
54
51
return React . DOM . span ( this . domProps , this . value ) ;
55
52
}
56
- } ;
53
+ } ) ;
57
54
}
58
55
59
56
export default generator ;
0 commit comments