Skip to content

Commit

Permalink
fix(antd): fix ConfigProvider.ConfigContext error in antd@4.6.3- (#2956)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifblooms authored Mar 18, 2022
1 parent 2d42894 commit 3bdfe2f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/antd/src/__builtins__/hooks/usePrefixCls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export const usePrefixCls = (
prefixCls?: string
}
) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
return getPrefixCls(tag, props?.prefixCls)
if ('ConfigContext' in ConfigProvider) {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
return getPrefixCls(tag, props?.prefixCls)
} else {
const prefix = props?.prefixCls ?? 'ant-'
return `${prefix}${tag ?? ''}`
}
}

0 comments on commit 3bdfe2f

Please sign in to comment.