Fix <Icon type="cross" /> compatibility, #12970

This commit is contained in:
afc163 2018-11-06 11:39:49 +08:00
parent 4c5e3492ac
commit 488f5a101d
3 changed files with 13 additions and 1 deletions

View File

@ -93,6 +93,7 @@ const icons = [
'exclamation-circle-o',
'exclamation-circle',
'close',
'cross',
'close-circle',
'close-circle-o',
'close-square',

View File

@ -6,6 +6,7 @@ import createFromIconfontCN from './IconFont';
import {
svgBaseProps, withThemeSuffix,
removeTypeTheme, getThemeFromTypeName,
alias,
} from './utils';
import warning from '../_util/warning';
import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
@ -135,7 +136,7 @@ const Icon: IconComponent<IconProps> = (props) => {
` the 'theme' prop '${theme}' will be ignored.`);
}
computedType = withThemeSuffix(
removeTypeTheme(type),
removeTypeTheme(alias(type)),
dangerousTheme || theme || defaultTheme,
);
innerNode = (

View File

@ -47,3 +47,13 @@ export function withThemeSuffix(type: string, theme: ThemeType) {
}
return result;
}
// For alias or compatibility
export function alias(type: string) {
switch (type) {
case 'cross':
return 'close';
default:
}
return type;
}