From bcd83040395265966961f219e0f114c4ffe115d7 Mon Sep 17 00:00:00 2001 From: torki Date: Sat, 12 Jun 2021 05:25:54 +0430 Subject: [PATCH] feat: add submit and cancel functions --- src/hooks/usePicker.ts | 8 ++++---- src/index.tsx | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/hooks/usePicker.ts b/src/hooks/usePicker.ts index fbadbaf..d122cfb 100644 --- a/src/hooks/usePicker.ts +++ b/src/hooks/usePicker.ts @@ -30,7 +30,7 @@ import { usePrevious } from './usePrevious'; import { solarEvents } from '../events/solar'; // Types import type { - DateConfig, + DatePickerConfig, DateConfigTypes, PickerExtraDateInfo, PickerDateModel, @@ -47,11 +47,11 @@ export function usePicker(props: WheelPickerProps) { /** * Date picker columns config * - * @return {Required} + * @return {Required} * @private */ - const configs = useMemo>(() => { - const config = { ...props.config } as Required; + const configs = useMemo>(() => { + const config = { ...props.config } as Required; if (config.month && !config.month.formatter) { config.month.formatter = (value) => jalaliMonths[value.month!]; } diff --git a/src/index.tsx b/src/index.tsx index 53926ab..2901de7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -15,10 +15,8 @@ import type { WheelPickerSelectEvent } from './components/WheelPicker/index.type const Picker: React.FC = (props) => { const [isOpen, setIsOpen] = React.useState(false); - const [ - selectedDate, - setSelectedDate, - ] = React.useState(); + const [selectedDate, setSelectedDate] = + React.useState(); React.useEffect(() => { setIsOpen(props.isOpen); @@ -57,7 +55,6 @@ const Picker: React.FC = (props) => { maxDate={props.maxDate} endYear={props.endYear} onChange={handleOnChange} - disabled={props.disabled} startYear={props.startYear} addDayName={props.addDayName} initialValue={props.initialValue} @@ -88,7 +85,6 @@ Picker.defaultProps = { classNamePrefix: 'persian-datepicker', submitText: 'تایید', cancelText: 'انصراف', - disabled: false, showCancelButton: true, disableSheetDrag: true, addDayName: false, @@ -97,7 +93,7 @@ Picker.defaultProps = { export { Picker, WheelPicker }; export * from './helpers/date'; export type { - DateConfig, + DatePickerConfig, WheelPickerSelectEvent, WheelPickerProps, PickerColumnCaption,