@@ -171,15 +171,21 @@ export class UIView extends Component<UIViewProps, UIViewState> {
171
171
} ;
172
172
}
173
173
174
+ // attach any style or className to the rendered component
175
+ // specified on the UIView itself
176
+ const { className, style } = this . props ;
177
+ const styleProps = { className, style } ;
178
+ const childProps = { ...props , ...styleProps } ;
179
+
174
180
let child =
175
181
! loaded && isValidElement ( children )
176
- ? cloneElement ( children , props )
177
- : createElement ( component , props ) ;
182
+ ? cloneElement ( children , childProps )
183
+ : createElement ( component , childProps ) ;
178
184
179
185
// if a render function is passed use that,
180
186
// otherwise render the component normally
181
187
return typeof render !== 'undefined' && loaded
182
- ? render ( component , props )
188
+ ? render ( component , childProps )
183
189
: child ;
184
190
}
185
191
@@ -262,19 +268,10 @@ export class UIView extends Component<UIViewProps, UIViewState> {
262
268
this . uiViewData . config = newConfig ;
263
269
let props = { ...resolves , transition : trans } ;
264
270
265
- // attach any style or className to the rendered component
266
- // specified on the UIView itself
267
- let styleProps : {
268
- className ?: string ;
269
- style ?: Object ;
270
- } = { } ;
271
- if ( this . props . className ) styleProps . className = this . props . className ;
272
- if ( this . props . className ) styleProps . style = this . props . style ;
273
-
274
271
this . setState ( {
275
272
component : newComponent || 'div' ,
276
- props : newComponent ? extend ( props , styleProps ) : styleProps ,
277
- loaded : newComponent ? true : false ,
273
+ props : newComponent ? props : { } ,
274
+ loaded : ! ! newComponent ,
278
275
} ) ;
279
276
}
280
277
0 commit comments