Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit b819d9b

Browse files
authored
Merge pull request #64 from evless/fix/support-nested-structure
fix: fixed nested structure with text
2 parents bd18398 + e00e12f commit b819d9b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

example/stories/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ storiesOf('Basic', module)
1717
.add('flow', () => <SmartKnobedComponentWithFlow />)
1818
.add('nested example', () => (
1919
<div>
20-
<span />
20+
<h1>Title</h1>
2121
<SmartKnobedComponent />
2222
</div>
2323
))

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ const getNewProps = (target, context) => {
9898

9999
const mutateChildren = (component) => {
100100
return cloneElement(component, { children: Children.map(component.props.children, (child) => {
101-
if (child.type.__docgenInfo) {
101+
if (child.type && child.type.__docgenInfo) {
102102
const newProps = getNewProps(child)
103103

104104
return cloneElement(child, { ...child.props, ...newProps })
105105
}
106106

107-
if (child.props.children) {
107+
if (child.props && child.props.children) {
108108
return mutateChildren(child)
109109
}
110110

0 commit comments

Comments
 (0)