mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
Fix button render with null or undefined child. (#5473)
* Fix button render with null or undefined child. Fix bug #5472 * Add missing semicolon * Make if statement braced. ......
This commit is contained in:
parent
9b8ef5a0b7
commit
041bbee2c0
@ -12,6 +12,10 @@ function isString(str) {
|
|||||||
|
|
||||||
// Insert one space between two chinese characters automatically.
|
// Insert one space between two chinese characters automatically.
|
||||||
function insertSpace(child) {
|
function insertSpace(child) {
|
||||||
|
// Check the child if is undefined or null.
|
||||||
|
if (child == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isString(child.type) && isTwoCNChar(child.props.children)) {
|
if (isString(child.type) && isTwoCNChar(child.props.children)) {
|
||||||
return React.cloneElement(child, {},
|
return React.cloneElement(child, {},
|
||||||
child.props.children.split('').join(' '));
|
child.props.children.split('').join(' '));
|
||||||
|
Loading…
Reference in New Issue
Block a user