mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
chore: Fix word spelling errors (#40472)
* chore: Fix word spelling errors * chore: update * chore: Argument name of useMessage (#1) --------- Co-authored-by: luo3house <96865086+luo3house@users.noreply.github.com>
This commit is contained in:
parent
0ab8419d6b
commit
218d8f441c
@ -19,7 +19,7 @@ const methods: NoticeType[] = ['success', 'info', 'warning', 'error', 'loading']
|
||||
|
||||
let message: GlobalMessage | null = null;
|
||||
|
||||
let act: (callback: VoidFunction) => Promise<void> | void = (callback: VoidFunction) => callback();
|
||||
let act: (callback: VoidFunction) => Promise<void> | void = (callback) => callback();
|
||||
|
||||
interface GlobalMessage {
|
||||
fragment: DocumentFragment;
|
||||
@ -84,7 +84,7 @@ interface GlobalHolderRef {
|
||||
}
|
||||
|
||||
const GlobalHolder = React.forwardRef<GlobalHolderRef, {}>((_, ref) => {
|
||||
const initializeMeassgConfig: () => ConfigOptions = () => {
|
||||
const initializeMessageConfig: () => ConfigOptions = () => {
|
||||
const { prefixCls, container, maxCount, duration, rtl, top } = getGlobalContext();
|
||||
|
||||
return {
|
||||
@ -97,16 +97,16 @@ const GlobalHolder = React.forwardRef<GlobalHolderRef, {}>((_, ref) => {
|
||||
};
|
||||
};
|
||||
|
||||
const [meassgConfig, setMeassgConfig] = React.useState<ConfigOptions>(initializeMeassgConfig);
|
||||
const [messageConfig, setMessageConfig] = React.useState<ConfigOptions>(initializeMessageConfig);
|
||||
|
||||
const [api, holder] = useInternalMessage(meassgConfig);
|
||||
const [api, holder] = useInternalMessage(messageConfig);
|
||||
|
||||
const global = globalConfig();
|
||||
const rootPrefixCls = global.getRootPrefixCls();
|
||||
const rootIconPrefixCls = global.getIconPrefixCls();
|
||||
|
||||
const sync = () => {
|
||||
setMeassgConfig(initializeMeassgConfig);
|
||||
setMessageConfig(initializeMessageConfig);
|
||||
};
|
||||
|
||||
React.useEffect(sync, []);
|
||||
|
@ -98,7 +98,7 @@ const Holder = React.forwardRef<HolderRef, HolderProps>((props, ref) => {
|
||||
let keyIndex = 0;
|
||||
|
||||
export function useInternalMessage(
|
||||
notificationConfig?: HolderProps,
|
||||
messageConfig?: HolderProps,
|
||||
): readonly [MessageInstance, React.ReactElement] {
|
||||
const holderRef = React.useRef<HolderRef>(null);
|
||||
|
||||
@ -213,12 +213,9 @@ export function useInternalMessage(
|
||||
}, []);
|
||||
|
||||
// ============================== Return ===============================
|
||||
return [
|
||||
wrapAPI,
|
||||
<Holder key="message-holder" {...notificationConfig} ref={holderRef} />,
|
||||
] as const;
|
||||
return [wrapAPI, <Holder key="message-holder" {...messageConfig} ref={holderRef} />] as const;
|
||||
}
|
||||
|
||||
export default function useMessage(notificationConfig?: ConfigOptions) {
|
||||
return useInternalMessage(notificationConfig);
|
||||
export default function useMessage(messageConfig?: ConfigOptions) {
|
||||
return useInternalMessage(messageConfig);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user