react-truncate
react-truncate copied to clipboard
Bug with <span>text</span> in children
Hello, i have this code for truncate
<Truncate
key="body"
lines={!this.state.expanded && 5}
className={classnames({
[s.expand]: !this.state.expanded,
})}
ellipsis={
<div className={s.readMore} onClick={this.onTruncatedExpandClick}>
{'Read more'}
</div>
}
onTruncate={this.onTruncate}
>
{children.split('\n').map((item, key) => <span key={key}>{item}{childrenRows !== (key + 1) ? <br /> : '' }</span>)}
{status === 'edited' ? (
<span className={s.edited}>{`${this.props.intl.formatMessage(messages.edited)}`}</span>
) : null}
</Truncate>
if text lines more than 5, Read more is displayed and after expand i have this result

But if text lines 1, Edited text dispalyed as text without

How can i fix it?