mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
chore(all): sync with main for beta 7
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { ToastOptions, toastController } from '@ionic/core/components';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { HookOverlayOptions } from './HookOverlayOptions';
|
||||
import { useController } from './useController';
|
||||
@ -13,9 +14,7 @@ export function useIonToast(): UseIonToastResult {
|
||||
toastController
|
||||
);
|
||||
|
||||
function present(message: string, duration?: number): void;
|
||||
function present(options: ToastOptions & HookOverlayOptions): void;
|
||||
function present(messageOrOptions: string | ToastOptions & HookOverlayOptions, duration?: number) {
|
||||
const present = useCallback((messageOrOptions: string | ToastOptions & HookOverlayOptions, duration?: number) => {
|
||||
if (typeof messageOrOptions === 'string') {
|
||||
controller.present({
|
||||
message: messageOrOptions,
|
||||
@ -24,7 +23,7 @@ export function useIonToast(): UseIonToastResult {
|
||||
} else {
|
||||
controller.present(messageOrOptions);
|
||||
}
|
||||
};
|
||||
}, [controller.present]);
|
||||
|
||||
return [
|
||||
present,
|
||||
|
Reference in New Issue
Block a user