mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(react): present and dismiss hooks return promises (#24299)
This commit is contained in:
@ -21,13 +21,13 @@ export function useIonLoading(): UseIonLoadingResult {
|
||||
spinner?: SpinnerTypes
|
||||
) => {
|
||||
if (typeof messageOrOptions === 'string') {
|
||||
controller.present({
|
||||
return controller.present({
|
||||
message: messageOrOptions,
|
||||
duration,
|
||||
spinner: spinner ?? 'lines',
|
||||
});
|
||||
} else {
|
||||
controller.present(messageOrOptions);
|
||||
return controller.present(messageOrOptions);
|
||||
}
|
||||
},
|
||||
[controller.present]
|
||||
@ -44,15 +44,15 @@ export type UseIonLoadingResult = [
|
||||
* @param duration Optional - Number of milliseconds to wait before dismissing the loading indicator
|
||||
* @param spinner Optional - The name of the spinner to display, defaults to "lines"
|
||||
*/
|
||||
(message?: string, duration?: number, spinner?: SpinnerTypes): void;
|
||||
(message?: string, duration?: number, spinner?: SpinnerTypes): Promise<void>;
|
||||
/**
|
||||
* Presents the loading indicator
|
||||
* @param options The options to pass to the IonLoading
|
||||
*/
|
||||
(options: LoadingOptions & HookOverlayOptions): void;
|
||||
(options: LoadingOptions & HookOverlayOptions): Promise<void>;
|
||||
},
|
||||
/**
|
||||
* Dismisses the loading indicator
|
||||
*/
|
||||
() => void
|
||||
() => Promise<void>
|
||||
];
|
||||
|
Reference in New Issue
Block a user