@@ -21,31 +21,21 @@ type ThemeComponent = {
21
21
22
22
function asBaseComponent < PROPS , STATICS = { } > ( WrappedComponent : React . ComponentType < any > ) : React . ComponentClass < PROPS & ThemeComponent > & STATICS {
23
23
class BaseComponent extends UIComponent {
24
- state = Modifiers . generateModifiersStyle ( undefined , BaseComponent . getThemeProps ( this . props , this . context ) ) ;
25
24
static displayName : string | undefined ;
26
25
static propTypes : any ;
27
26
static defaultProps : any ;
28
27
29
- static getDerivedStateFromProps ( nextProps : any , prevState : any ) {
30
- const themeProps = BaseComponent . getThemeProps ( nextProps , undefined ) ;
31
- const newModifiers = Modifiers . generateModifiersStyle ( undefined , themeProps ) ;
32
- if ( ! _ . isEqual ( newModifiers , prevState ) ) {
33
- return newModifiers ;
34
- }
35
-
36
- return null ;
37
- }
38
-
39
28
static getThemeProps = ( props : any , context : any ) => {
40
29
return Modifiers . getThemeProps . call ( WrappedComponent , props , context ) ;
41
30
}
42
31
43
32
render ( ) {
44
33
const themeProps = BaseComponent . getThemeProps ( this . props , this . context ) ;
34
+ const modifiers = Modifiers . generateModifiersStyle ( undefined , themeProps ) ;
45
35
// TODO: omit original modifiers props (left, right, flex, etc..)
46
36
// Because they throws an error when being passed to RNView on Android
47
37
const { forwardedRef, ...others } = themeProps ;
48
- return < WrappedComponent /* {...this.props} */ { ... others } modifiers = { this . state } ref = { forwardedRef } /> ;
38
+ return < WrappedComponent { ...others } modifiers = { modifiers } ref = { forwardedRef } /> ;
49
39
}
50
40
}
51
41
0 commit comments