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

@ -19,12 +19,12 @@ export function useIonPicker(): UseIonPickerResult {
buttons?: PickerButton[]
) => {
if (Array.isArray(columnsOrOptions)) {
controller.present({
return controller.present({
columns: columnsOrOptions,
buttons: buttons ?? [{ text: 'Ok' }],
});
} else {
controller.present(columnsOrOptions);
return controller.present(columnsOrOptions);
}
}, [controller.present]);
@ -38,15 +38,15 @@ export type UseIonPickerResult = [
* @param columns Array of columns to be displayed in the picker.
* @param buttons Optional - Array of buttons to be displayed at the top of the picker.
*/
(columns: PickerColumn[], buttons?: PickerButton[]): void;
(columns: PickerColumn[], buttons?: PickerButton[]): Promise<void>;
/**
* Presents the picker
* @param options The options to pass to the IonPicker
*/
(options: PickerOptions & HookOverlayOptions): void;
(options: PickerOptions & HookOverlayOptions): Promise<void>;
},
/**
* Dismisses the picker
*/
() => void
() => Promise<void>
];