1+ import reactCreateClass from "./react-create-class" ;
12import React from "react" ;
23import Globalize from "globalize" ;
34
@@ -22,18 +23,15 @@ function generator(fn, localPropNames, options) {
2223 } ;
2324 var globalizePropNames = commonPropNames . concat ( localPropNames ) ;
2425
25- return class extends React . Component {
26- //static displayName = Fn;
27-
28- componentWillMount ( ) {
26+ return reactCreateClass ( {
27+ displayName : Fn ,
28+ componentWillMount : function ( ) {
2929 this . setup ( this . props ) ;
30- }
31-
32- componentWillReceiveProps ( nextProps ) {
30+ } ,
31+ componentWillReceiveProps : function ( nextProps ) {
3332 this . setup ( nextProps ) ;
34- }
35-
36- setup ( props ) {
33+ } ,
34+ setup : function ( props ) {
3735 this . globalize = props . locale ? Globalize ( props . locale ) : Globalize ;
3836 this . domProps = Object . keys ( props ) . filter ( omit ( globalizePropNames ) ) . reduce ( function ( memo , propKey ) {
3937 memo [ propKey ] = props [ propKey ] ;
@@ -48,12 +46,11 @@ function generator(fn, localPropNames, options) {
4846 beforeFormat . call ( this , props ) ;
4947 var formattedValue = this . globalize [ fn ] . apply ( this . globalize , this . globalizePropValues ) ;
5048 this . value = afterFormat . call ( this , formattedValue ) ;
51- }
52-
53- render ( ) {
49+ } ,
50+ render : function ( ) {
5451 return React . DOM . span ( this . domProps , this . value ) ;
5552 }
56- } ;
53+ } ) ;
5754}
5855
5956export default generator ;
0 commit comments