Skip to content

Commit

Permalink
fix null or empty children. #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawan committed Aug 25, 2019
1 parent e3015d8 commit 60e0ad1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Hyperlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ class Hyperlink extends Component {
}

parse (component) {
let { props: { children} = {}, type: { displayName } = {} } = component
let {
props: { children } = {},
type: { displayName } = {},
} = component || {}
if (!children)
return component

Expand All @@ -118,7 +121,7 @@ class Hyperlink extends Component {
}

return React.cloneElement(component, componentProps, React.Children.map(children, child => {
let { type : { displayName } = {} } = child
let { type : { displayName } = {} } = child || {}
if (typeof child === 'string' && this.linkifyIt.pretest(child))
return this.linkify(<Text { ...componentProps } style={ component.props.style }>{ child }</Text>)
if (displayName === 'Text' && !this.isTextNested(child))
Expand Down

0 comments on commit 60e0ad1

Please sign in to comment.