@@ -18,14 +18,21 @@ export default class CloudinaryComponent extends Component {
1818 }
1919
2020 getChildTransformations ( children ) {
21- return React . Children . map ( children , child => {
22- let options = CloudinaryComponent . normalizeOptions ( child . props , child . context ) ;
21+ if ( children === undefined || children === null ) return null ;
22+ let mapped = React . Children . map ( children , child => {
23+ let options = { } ;
24+ if ( child . type && child . type . name === "Transformation" ) {
25+ options = CloudinaryComponent . normalizeOptions ( child . props , child . context ) ;
26+ }
2327 let childOptions = this . getChildTransformations ( child . props . children ) ;
2428 if ( childOptions !== undefined && childOptions !== null ) {
2529 options . transformation = childOptions ;
2630 }
2731 return options ;
2832 } ) ;
33+ if ( mapped != null ) {
34+ return mapped . filter ( o => ! Util . isEmpty ( o ) ) ;
35+ } else return null ;
2936 }
3037
3138 getTransformation ( options ) {
@@ -34,9 +41,10 @@ export default class CloudinaryComponent extends Component {
3441 let childrenOptions = this . getChildTransformations ( this . props . children ) ;
3542 if ( ! Util . isEmpty ( childrenOptions ) ) {
3643 transformation = childrenOptions ;
44+ return { ...options , transformation} ;
3745 }
3846 }
39- return { ...options , transformation } ;
47+ return { ...options } ;
4048 }
4149
4250 /**
@@ -65,7 +73,7 @@ export default class CloudinaryComponent extends Component {
6573 }
6674
6775}
68- CloudinaryComponent . VALID_OPTIONS = Configuration . CONFIG_PARAMS . concat ( Transformation . new ( ) . PARAM_NAMES ) . map ( camelCase ) ;
76+ CloudinaryComponent . VALID_OPTIONS = Transformation . PARAM_NAMES . map ( camelCase ) ;
6977CloudinaryComponent . contextTypes = typesFrom ( CloudinaryComponent . VALID_OPTIONS ) ;
7078
7179CloudinaryComponent . propTypes = CloudinaryComponent . contextTypes ;
0 commit comments