diff --git a/package.json b/package.json index 555d6a5..b2aba4c 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0-beta.91", "description": "A customizable calendar, time & month picker for React Native (including Persian Jalaali calendar & locale)", "main": "src/index.js", + "types": "src/types/index.d.ts", "scripts": { "playground": "cd playground && react-native start" }, diff --git a/src/types/index.d.ts b/src/types/index.d.ts new file mode 100644 index 0000000..f5c5f3c --- /dev/null +++ b/src/types/index.d.ts @@ -0,0 +1,62 @@ +import type {FunctionComponent} from 'react'; +import type { StyleProp, ViewStyle } from "react-native"; + +declare const ModernDatePicker:FunctionComponent +export default ModernDatePicker +export declare function getFormatedDate(date?: Date, format?: string):string +export declare function getToday():string + +export interface ModernDatePickerProps { + /** Gets called when selected value changes */ + onSelectedChange: (dateString: string) => void + /** Gets called when month changes */ + onMonthYearChange: (dateString: string) => void + /** Gets called when time changes */ + onTimeChange: (dateString: string) => void + /** Gets called when date changes */ + onDateChange: (dateString: string) => void + + /** Initially visible month */ + current: string + /** The primary value of the date picker */ + selected: string + /** Specifies the minimum selectable day by user */ + minimumDate: string + /** Specifies the maximum selectable day by user */ + maximumDate: string + + /** The minimum selectable year when user opens the year selector */ + selectorStartingYear: number + /** The maxium selectable year when user opens the year selector */ + selectorEndingYear: number + + /** Disable month & year from being changed */ + disableDateChange: boolean + /** Switches between 'Gregorian' & 'Jalaali' mode */ + isGregorian: boolean + + /** Customizing date picker style */ + options: Partial + + mode: 'datepicker' | 'calendar' | 'monthYear' | 'time' + + minuteInterval: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30 | 60 + + /** Changes date picker container style */ + style: StyleProp +} + +export interface ModernDatePickerOptions { + textHeaderColor: string + textDefaultColor: string + selectedTextColor: string + mainColor: string + textSecondaryColor: string + borderColor: string + defaultFont: string + headerFont: string + textFontSize: number + textHeaderFontSize: number + headerAnimationDistance: number + daysAnimationDistance: number +} \ No newline at end of file