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:
Wuxh 2023-02-01 10:14:21 +08:00 committed by GitHub
parent 0ab8419d6b
commit 218d8f441c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View File

@ -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, []);

View File

@ -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);
}