fix(react): present and dismiss hooks return promises (#24299)

This commit is contained in:
Sean Perkins
2021-12-01 15:16:55 -05:00
committed by GitHub
parent e41b0e0cf2
commit 4b26feaa47
5 changed files with 25 additions and 25 deletions

View File

@ -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>
];