mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
chore(react): migrate to eslint, add prettier (#26633)
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
import {
|
||||
PickerButton,
|
||||
PickerColumn,
|
||||
PickerOptions,
|
||||
pickerController,
|
||||
} from '@ionic/core/components';
|
||||
import type { PickerButton, PickerColumn, PickerOptions } from '@ionic/core/components';
|
||||
import { pickerController } from '@ionic/core/components';
|
||||
import { defineCustomElement } from '@ionic/core/components/ion-picker.js';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { HookOverlayOptions } from './HookOverlayOptions';
|
||||
import type { HookOverlayOptions } from './HookOverlayOptions';
|
||||
import { useController } from './useController';
|
||||
|
||||
/**
|
||||
@ -21,19 +17,19 @@ export function useIonPicker(): UseIonPickerResult {
|
||||
defineCustomElement
|
||||
);
|
||||
|
||||
const present = useCallback((
|
||||
columnsOrOptions: PickerColumn[] | (PickerOptions & HookOverlayOptions),
|
||||
buttons?: PickerButton[]
|
||||
) => {
|
||||
if (Array.isArray(columnsOrOptions)) {
|
||||
return controller.present({
|
||||
columns: columnsOrOptions,
|
||||
buttons: buttons ?? [{ text: 'Ok' }],
|
||||
});
|
||||
} else {
|
||||
return controller.present(columnsOrOptions);
|
||||
}
|
||||
}, [controller.present]);
|
||||
const present = useCallback(
|
||||
(columnsOrOptions: PickerColumn[] | (PickerOptions & HookOverlayOptions), buttons?: PickerButton[]) => {
|
||||
if (Array.isArray(columnsOrOptions)) {
|
||||
return controller.present({
|
||||
columns: columnsOrOptions,
|
||||
buttons: buttons ?? [{ text: 'Ok' }],
|
||||
});
|
||||
} else {
|
||||
return controller.present(columnsOrOptions);
|
||||
}
|
||||
},
|
||||
[controller.present]
|
||||
);
|
||||
|
||||
return [present, controller.dismiss];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user