@@ -284,6 +284,22 @@ function locationBuilder(location) {
284284 return urlParts . join ( '%7C' ) ; // |
285285}
286286
287+ function isStatelessComponent ( component ) {
288+ return ! component . render && ! ( component . prototype && component . prototype . render ) ;
289+ }
290+
291+ function isClassComponent ( component ) {
292+ return Boolean ( component && component . prototype . isReactComponent && component . prototype . render ) ;
293+ }
294+
295+ function renderStatelessComponent ( component , props ) {
296+ return component ( props ) ;
297+ }
298+
299+ function renderClassComponent ( component , props ) {
300+ return new component ( props ) . render ( ) ;
301+ }
302+
287303var markerStrategy = function markerStrategy ( _ref , parentProps ) {
288304 var props = _ref . props ;
289305 var size = props . size ,
@@ -572,19 +588,35 @@ var StaticGoogleMap = function (_Component) {
572588 createClass ( StaticGoogleMap , [ {
573589 key : 'buildParts' ,
574590 value : function buildParts ( children , props ) {
575- return React__default . Children . map ( children , function ( Child ) {
576- switch ( Child . type . name ) {
591+ var _this2 = this ;
592+
593+ return React__default . Children . map ( children , function ( child ) {
594+ if ( ! React__default . isValidElement ( child ) ) {
595+ return null ;
596+ }
597+
598+ switch ( child . type . name ) {
577599 case 'Marker' :
578- return markerStrategy ( Child , props ) ;
600+ return markerStrategy ( child , props ) ;
579601 case 'MarkerGroup' :
580- return markerGroupStrategy ( Child , props ) ;
602+ return markerGroupStrategy ( child , props ) ;
581603 case 'Path' :
582- return pathStrategy ( Child , props ) ;
604+ return pathStrategy ( child , props ) ;
583605 case 'PathGroup' :
584- return pathGroupStrategy ( Child , props ) ;
606+ return pathGroupStrategy ( child , props ) ;
585607 case 'Direction' :
586- return directionStrategy ( Child , props ) ;
608+ return directionStrategy ( child , props ) ;
587609 default :
610+ var componentType = child . type ;
611+
612+ if ( isStatelessComponent ( componentType ) ) {
613+ return _this2 . buildParts ( renderStatelessComponent ( componentType , _extends ( { } , child . props ) ) , props ) ;
614+ }
615+
616+ if ( isClassComponent ( componentType ) ) {
617+ return _this2 . buildParts ( renderClassComponent ( componentType , _extends ( { } , child . props ) ) , props ) ;
618+ }
619+
588620 return null ;
589621 }
590622 } ) ;
0 commit comments