mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
refactor: delete deprecated React.ReactChild (#37551)
use React.ReactElement | string | number to replace the deprecated React.ReactChild
This commit is contained in:
parent
c161ab6e40
commit
3619caf1b4
@ -29,7 +29,7 @@ function isReactFragment(node: React.ReactNode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert one space between two chinese characters automatically.
|
// Insert one space between two chinese characters automatically.
|
||||||
function insertSpace(child: React.ReactChild, needInserted: boolean) {
|
function insertSpace(child: React.ReactElement | string | number, needInserted: boolean) {
|
||||||
// Check the child if is undefined or null.
|
// Check the child if is undefined or null.
|
||||||
if (child === null || child === undefined) {
|
if (child === null || child === undefined) {
|
||||||
return;
|
return;
|
||||||
@ -74,7 +74,7 @@ function spaceChildren(children: React.ReactNode, needInserted: boolean) {
|
|||||||
|
|
||||||
// Pass to React.Children.map to auto fill key
|
// Pass to React.Children.map to auto fill key
|
||||||
return React.Children.map(childList, child =>
|
return React.Children.map(childList, child =>
|
||||||
insertSpace(child as React.ReactChild, needInserted),
|
insertSpace(child as React.ReactElement | string | number, needInserted),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user