diff --git a/src/components/auto-center/auto-center.tsx b/src/components/auto-center/auto-center.tsx index 1b785422f3..5713d28294 100644 --- a/src/components/auto-center/auto-center.tsx +++ b/src/components/auto-center/auto-center.tsx @@ -1,15 +1,20 @@ -import React from 'react' import type { FC, ReactNode } from 'react' +import React from 'react' import { NativeProps, withNativeProps } from '../../utils/native-props' +import { useConfig } from '../config-provider' -const classPrefix = 'adm-auto-center' - -export type AutoCenterProps = { children?: ReactNode } & NativeProps +export type AutoCenterProps = { + children?: ReactNode + prefixCls?: string +} & NativeProps -export const AutoCenter: FC = props => - withNativeProps( +export const AutoCenter: FC = props => { + const { getPrefixCls } = useConfig() + const prefixCls = getPrefixCls('auto-center', props.prefixCls) + return withNativeProps( props, -
-
{props.children}
+
+
{props.children}
) +}